Added tests for ContentType/Group/Permission.__str__().
This commit is contained in:
parent
3defe76385
commit
194a4b526c
|
@ -368,3 +368,15 @@ class AnonymousUserTests(SimpleTestCase):
|
||||||
def test_check_password(self):
|
def test_check_password(self):
|
||||||
with self.assertRaisesMessage(NotImplementedError, self.no_repr_msg):
|
with self.assertRaisesMessage(NotImplementedError, self.no_repr_msg):
|
||||||
self.user.check_password('password')
|
self.user.check_password('password')
|
||||||
|
|
||||||
|
|
||||||
|
class GroupTests(SimpleTestCase):
|
||||||
|
def test_str(self):
|
||||||
|
g = Group(name='Users')
|
||||||
|
self.assertEqual(str(g), 'Users')
|
||||||
|
|
||||||
|
|
||||||
|
class PermissionTests(TestCase):
|
||||||
|
def test_str(self):
|
||||||
|
p = Permission.objects.get(codename='view_customemailfield')
|
||||||
|
self.assertEqual(str(p), 'auth_tests | custom email field | Can view custom email field')
|
||||||
|
|
|
@ -199,6 +199,10 @@ class ContentTypesTests(TestCase):
|
||||||
ct_fetched = ContentType.objects.get_for_id(ct.pk)
|
ct_fetched = ContentType.objects.get_for_id(ct.pk)
|
||||||
self.assertIsNone(ct_fetched.model_class())
|
self.assertIsNone(ct_fetched.model_class())
|
||||||
|
|
||||||
|
def test_str(self):
|
||||||
|
ct = ContentType.objects.get(app_label='contenttypes_tests', model='site')
|
||||||
|
self.assertEqual(str(ct), 'site')
|
||||||
|
|
||||||
|
|
||||||
class TestRouter:
|
class TestRouter:
|
||||||
def db_for_read(self, model, **hints):
|
def db_for_read(self, model, **hints):
|
||||||
|
|
Loading…
Reference in New Issue