Projet

Général

Profil

0001-templatetags-use-unicode_literals-37880.patch

Emmanuel Cazenave, 22 novembre 2019 12:53

Télécharger (1,96 ko)

Voir les différences:

Subject: [PATCH] templatetags: use unicode_literals (#37880)

 passerelle/base/templatetags/passerelle.py |  2 +-
 tests/test_templatetags.py                 | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
passerelle/base/templatetags/passerelle.py
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17 17

  
18
from __future__ import absolute_import
18
from __future__ import absolute_import, unicode_literals
19 19

  
20 20
import collections
21 21
import re
tests/test_templatetags.py
17 17
import inspect
18 18

  
19 19
from django.apps import apps
20
from django.utils import translation
20 21

  
21
from passerelle.base.templatetags.passerelle import render_body_schemas
22
from passerelle.base.templatetags.passerelle import render_body_schemas, render_json_schema
22 23

  
23 24

  
24 25
def test_render_body_schemas(db):
......
41 42
    assert schemas , 'no endpoint with schema found'
42 43
    for schema, endpoint in schemas:
43 44
        assert render_body_schemas(schema), 'failed for %s' % endpoint
45

  
46

  
47
def test_render_json_schema():
48
    SCHEMA = {
49
        '$schema': 'http://json-schema.org/draft-04/schema#',
50
        'type': 'object',
51
        'required': ['foo'],
52
        'additionalProperties': False,
53
        'properties': {
54
            'foo': {
55
                'type': 'string',
56
            },
57
        }
58
    }
59
    # Check that no unicode crash occurs
60
    with translation.override('fr'):
61
        render_json_schema(SCHEMA)
44
-