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.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/inspectdb/tests.py b/tests/inspectdb/tests.py
index 8be1681106..1deffff140 100644
--- a/tests/inspectdb/tests.py
+++ b/tests/inspectdb/tests.py
@@ -204,6 +204,16 @@ class InspectDBTestCase(TestCase):
output,
)
+ @skipUnlessDBFeature('can_introspect_foreign_keys')
+ def test_foreign_key_to_field(self):
+ out = StringIO()
+ call_command('inspectdb', 'inspectdb_foreignkeytofield', stdout=out)
+ self.assertIn(
+ "to_field_fk = models.ForeignKey('InspectdbPeoplemoredata', "
+ "models.DO_NOTHING, to_field='people_unique_id')",
+ out.getvalue(),
+ )
+
def test_digits_column_name_introspection(self):
"""Introspection of column names consist/start with digits (#16536/#17676)"""
char_field_type = connection.features.introspected_field_types['CharField']