Esempio n. 1
0
class PhotoAdminTestCase(TestCase):

    fixtures = ['photoshare_fixture.json', 'user_fixture.json', ]

    def setUp(self):
        admin = AdminSite()
        self.ma = PhotoAdmin(Photo, admin)
        for owner in User.objects.all():
            photo = Photo(owner=owner)
            photo.save()

    def test_owner_link(self):
        expected_link_path = '/admin/auth/user/%s'
        for photo in Photo.objects.all():
            expected = expected_link_path % photo.owner.pk
            actual = self.ma.owner_link(photo)
            self.assertTrue(expected in actual)
Esempio n. 2
0
 def setUp(self):
     admin = AdminSite()
     self.ma = PhotoAdmin(Photo, admin)
     for owner in User.objects.all():
         photo = Photo(owner=owner)
         photo.save()