first client test
This commit is contained in:
parent
b398b3a511
commit
6659d1a4a0
|
@ -1,14 +1,22 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from .models import HonoraryCertificate
|
from .models import HonoraryCertificate
|
||||||
|
|
||||||
# Create your tests here.
|
# Create your tests here.
|
||||||
class TestGranted(TestCase):
|
class TestGranted(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
#this supress an unwanted warning about missing root dir
|
||||||
|
settings.WHITENOISE_AUTOREFRESH = True
|
||||||
|
|
||||||
def test_set_granted(self):
|
def test_set_granted(self):
|
||||||
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)
|
||||||
print(obj.pk)
|
|
||||||
HonoraryCertificate.set_granted(obj.pk, True)
|
HonoraryCertificate.set_granted(obj.pk, True)
|
||||||
obj2 = HonoraryCertificate.objects.get(pk=obj.pk)
|
obj2 = HonoraryCertificate.objects.get(pk=obj.pk)
|
||||||
self.assertEqual(obj2.granted,True)
|
self.assertEqual(obj2.granted,True)
|
||||||
|
|
||||||
|
def test_source_link(self):
|
||||||
|
response = self.client.get('')
|
||||||
|
self.assertContains(response,'<a href="https://srcsrv.wikimedia.de/beba/foerderbarometer">Sourcecode</a>')
|
||||||
|
|
Loading…
Reference in New Issue