Added additional tests for album links.
This commit is contained in:
parent
e25f3da5a5
commit
85a34b20f9
@ -19,6 +19,18 @@ from lostplaces.tests.models import ModelTestCase
|
|||||||
class ExternalLinkTestCase(ModelTestCase):
|
class ExternalLinkTestCase(ModelTestCase):
|
||||||
model = ExternalLink
|
model = ExternalLink
|
||||||
|
|
||||||
|
def setup(self):
|
||||||
|
self.albumlink = ExternalLink.objects.get(id=1)
|
||||||
|
|
||||||
|
def test_label(self):
|
||||||
|
self.assertField('label', models.CharField)
|
||||||
|
|
||||||
|
def test_url(self):
|
||||||
|
self.assertField('url', models.URLField)
|
||||||
|
|
||||||
|
class PhotoAlbumTestCase(ModelTestCase):
|
||||||
|
model = PhotoAlbum
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpTestData(cls):
|
def setUpTestData(cls):
|
||||||
user = User.objects.create_user(
|
user = User.objects.create_user(
|
||||||
@ -35,7 +47,7 @@ class ExternalLinkTestCase(ModelTestCase):
|
|||||||
longitude=7.0,
|
longitude=7.0,
|
||||||
description='This is just a test, do not worry'
|
description='This is just a test, do not worry'
|
||||||
)
|
)
|
||||||
place.tags.add('I a tag', 'testlocation')
|
place.tags.add('I am a tag', 'testlocation')
|
||||||
place.save()
|
place.save()
|
||||||
|
|
||||||
PhotoAlbum.objects.create(
|
PhotoAlbum.objects.create(
|
||||||
@ -46,18 +58,9 @@ class ExternalLinkTestCase(ModelTestCase):
|
|||||||
submitted_when=timezone.now()
|
submitted_when=timezone.now()
|
||||||
)
|
)
|
||||||
|
|
||||||
def setup(self):
|
def setUp(self):
|
||||||
self.album_link = PhotoAlbum.objects.get(id=1)
|
self.albumlink = PhotoAlbum.objects.get(id=1)
|
||||||
|
self.place = Place.objects.get(id=1)
|
||||||
def test_label(self):
|
|
||||||
self.assertField('label', models.CharField)
|
|
||||||
|
|
||||||
def test_url(self):
|
|
||||||
self.assertField('url', models.URLField)
|
|
||||||
|
|
||||||
|
|
||||||
class PhotoAlbumTestCase(ModelTestCase):
|
|
||||||
model = PhotoAlbum
|
|
||||||
|
|
||||||
def test_place(self):
|
def test_place(self):
|
||||||
field = self.assertField('place', models.ForeignKey)
|
field = self.assertField('place', models.ForeignKey)
|
||||||
@ -73,3 +76,18 @@ class PhotoAlbumTestCase(ModelTestCase):
|
|||||||
expected_related_name
|
expected_related_name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def test_label(self):
|
||||||
|
albumlink = self.albumlink
|
||||||
|
|
||||||
|
self.assertTrue('TestLink' in albumlink.label,
|
||||||
|
msg='Expecting albumlink.label to contain \'TestLink\' string'
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_url(self):
|
||||||
|
albumlink = self.albumlink
|
||||||
|
|
||||||
|
self.assertTrue('lostplaces.example.com' in albumlink.url,
|
||||||
|
msg='Expecting albumlink.url to contain \'lostplaces.example.com\' string'
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user