summaryrefslogtreecommitdiff
path: root/tests/inspectdb/tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/inspectdb/tests.py')
-rw-r--r--tests/inspectdb/tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 6e3f4b8aa6..afe89e0dda 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -85,6 +85,15 @@ class InspectDBTestCase(TestCase):
elif not connection.features.interprets_empty_strings_as_nulls:
assertFieldType('uuid_field', "models.CharField(max_length=32)")
+ @skipUnlessDBFeature('can_introspect_json_field', 'supports_json_field')
+ def test_json_field(self):
+ out = StringIO()
+ call_command('inspectdb', 'inspectdb_jsonfieldcolumntype', stdout=out)
+ output = out.getvalue()
+ if not connection.features.interprets_empty_strings_as_nulls:
+ self.assertIn('json_field = models.JSONField()', output)
+ self.assertIn('null_json_field = models.JSONField(blank=True, null=True)', output)
+
def test_number_field_types(self):
"""Test introspection of various Django field types"""
assertFieldType = self.make_field_type_asserter()