You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
996 B

4 years ago
4 years ago
4 years ago
  1. from django.test import TestCase
  2. from django.conf import settings
  3. from .models import HonoraryCertificate
  4. # Create your tests here.
  5. class TestGranted(TestCase):
  6. def setUp(self):
  7. #this supress an unwanted warning about missing root dir
  8. settings.WHITENOISE_AUTOREFRESH = True
  9. def test_set_granted(self):
  10. obj = HonoraryCertificate.objects.create(realname='hurzel',email='hurzel@web.de')
  11. self.assertEqual(obj.granted,None)
  12. HonoraryCertificate.set_granted(obj.pk, True)
  13. obj2 = HonoraryCertificate.objects.get(pk=obj.pk)
  14. self.assertEqual(obj2.granted,True)
  15. def test_source_link(self):
  16. response = self.client.get('', follow=True)
  17. #print (response.content)
  18. self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>')
  19. def test_access_denied(self):
  20. response = self.client.get('/intern', follow=True)
  21. self.assertContains(response,'password')