From 00ab65d648f870e6af6b88f9769ec16d5871af45 Mon Sep 17 00:00:00 2001 From: Commander1024 Date: Fri, 18 Sep 2020 23:02:59 +0200 Subject: [PATCH] Added working tests. --- .../tests/models/test_link_model.py | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/django_lostplaces/lostplaces/tests/models/test_link_model.py b/django_lostplaces/lostplaces/tests/models/test_link_model.py index 8d8c47d..88fb389 100644 --- a/django_lostplaces/lostplaces/tests/models/test_link_model.py +++ b/django_lostplaces/lostplaces/tests/models/test_link_model.py @@ -18,11 +18,7 @@ from lostplaces.tests.models import ModelTestCase class ExternalLinkTestCase(ModelTestCase): model = ExternalLink - pass -class PhotoAlbumTestCase(ModelTestCase): - model = PhotoAlbum - @classmethod def setUpTestData(cls): user = User.objects.create_user( @@ -58,4 +54,22 @@ class PhotoAlbumTestCase(ModelTestCase): def test_url(self): self.assertField('url', models.URLField) - \ No newline at end of file + + +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 + ) + )