Completed test coverage for contenttypes models.

This commit is contained in:
Marcelo Galigniana 2022-10-11 00:38:39 -03:00 committed by GitHub
parent da8fa76413
commit f30c7e381c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -282,10 +282,18 @@ class ContentTypesTests(TestCase):
ct = ContentType.objects.get(app_label="contenttypes_tests", model="site") ct = ContentType.objects.get(app_label="contenttypes_tests", model="site")
self.assertEqual(str(ct), "contenttypes_tests | site") self.assertEqual(str(ct), "contenttypes_tests | site")
def test_name(self):
ct = ContentType.objects.get(app_label="contenttypes_tests", model="site")
self.assertEqual(ct.name, "site")
def test_app_labeled_name(self): def test_app_labeled_name(self):
ct = ContentType.objects.get(app_label="contenttypes_tests", model="site") ct = ContentType.objects.get(app_label="contenttypes_tests", model="site")
self.assertEqual(ct.app_labeled_name, "contenttypes_tests | site") self.assertEqual(ct.app_labeled_name, "contenttypes_tests | site")
def test_name_unknown_model(self):
ct = ContentType(app_label="contenttypes_tests", model="unknown")
self.assertEqual(ct.name, "unknown")
def test_app_labeled_name_unknown_model(self): def test_app_labeled_name_unknown_model(self):
ct = ContentType(app_label="contenttypes_tests", model="unknown") ct = ContentType(app_label="contenttypes_tests", model="unknown")
self.assertEqual(ct.app_labeled_name, "unknown") self.assertEqual(ct.app_labeled_name, "unknown")