Added working tests.

This commit is contained in:
Marcus Scholz 2020-09-18 23:02:59 +02:00
parent 79854f3fa1
commit 00ab65d648

View File

@ -18,10 +18,6 @@ from lostplaces.tests.models import ModelTestCase
class ExternalLinkTestCase(ModelTestCase): class ExternalLinkTestCase(ModelTestCase):
model = ExternalLink model = ExternalLink
pass
class PhotoAlbumTestCase(ModelTestCase):
model = PhotoAlbum
@classmethod @classmethod
def setUpTestData(cls): def setUpTestData(cls):
@ -59,3 +55,21 @@ class PhotoAlbumTestCase(ModelTestCase):
def test_url(self): def test_url(self):
self.assertField('url', models.URLField) self.assertField('url', models.URLField)
class PhotoAlbumTestCase(ModelTestCase):
model = PhotoAlbum
def test_place(self):
field = self.assertField('place', models.ForeignKey)
self.assertEqual(field.remote_field.on_delete, models.CASCADE,
msg='Expecting the deletion of %s to be cascading' % (
str(field)
)
)
expected_related_name = 'photo_albums'
self.assertEqual(field.remote_field.related_name, expected_related_name,
msg='Expecting the related name of %s to be %s' % (
str(field),
expected_related_name
)
)