From ad2a9f7ed87676a9e946bf2431d8c4a42e9e0102 Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 24 Jul 2019 12:09:46 +0200 Subject: [PATCH] TestFieldMapping is the more appropriate test class --- tests/schemas/test_openapi.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/schemas/test_openapi.py b/tests/schemas/test_openapi.py index 5b0195714..2bf305d99 100644 --- a/tests/schemas/test_openapi.py +++ b/tests/schemas/test_openapi.py @@ -53,6 +53,15 @@ class TestFieldMapping(TestCase): with self.subTest(field=field): assert inspector._map_field(field) == mapping + def test_lazy_string_field(self): + class Serializer(serializers.Serializer): + text = serializers.CharField(help_text=_('lazy string')) + + inspector = AutoSchema() + + data = inspector._map_serializer(Serializer()) + assert isinstance(data['properties']['text']['description'], str), "description must be str" + @pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.') class TestOperationIntrospection(TestCase): @@ -274,15 +283,6 @@ class TestOperationIntrospection(TestCase): assert response_schema['ip']['type'] == 'string' assert 'format' not in response_schema['ip'] - def test_lazy_string_field(self): - class Serializer(serializers.Serializer): - text = serializers.CharField(help_text=_('lazy string')) - - inspector = AutoSchema() - - data = inspector._map_serializer(Serializer()) - assert isinstance(data['properties']['text']['description'], str), "description must be str" - @pytest.mark.skipif(uritemplate is None, reason='uritemplate not installed.') @override_settings(REST_FRAMEWORK={'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.openapi.AutoSchema'})