|
@ -11,6 +11,7 @@ class TestGranted(TestCase): |
|
|
settings.WHITENOISE_AUTOREFRESH = True |
|
|
settings.WHITENOISE_AUTOREFRESH = True |
|
|
|
|
|
|
|
|
def test_set_granted(self): |
|
|
def test_set_granted(self): |
|
|
|
|
|
'''test if the model function set_granted() works as intended''' |
|
|
obj = HonoraryCertificate.objects.create(realname='hurzel',email='hurzel@web.de') |
|
|
obj = HonoraryCertificate.objects.create(realname='hurzel',email='hurzel@web.de') |
|
|
self.assertEqual(obj.granted,None) |
|
|
self.assertEqual(obj.granted,None) |
|
|
HonoraryCertificate.set_granted(obj.pk, True) |
|
|
HonoraryCertificate.set_granted(obj.pk, True) |
|
@ -18,10 +19,12 @@ class TestGranted(TestCase): |
|
|
self.assertEqual(obj2.granted,True) |
|
|
self.assertEqual(obj2.granted,True) |
|
|
|
|
|
|
|
|
def test_source_link(self): |
|
|
def test_source_link(self): |
|
|
|
|
|
'''test if link to source code is included in main page''' |
|
|
response = self.client.get('', follow=True) |
|
|
response = self.client.get('', follow=True) |
|
|
#print (response.content) |
|
|
#print (response.content) |
|
|
self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>') |
|
|
self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>') |
|
|
|
|
|
|
|
|
def test_access_denied(self): |
|
|
def test_access_denied(self): |
|
|
|
|
|
'''test if /intern redirects to login page if not logged in''' |
|
|
response = self.client.get('/intern', follow=True) |
|
|
response = self.client.get('/intern', follow=True) |
|
|
self.assertContains(response,'password') |
|
|
self.assertContains(response,'password') |