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.

42 lines
1.6 KiB

from django.test import TestCase
from django.conf import settings
from django.contrib.auth.models import User
from .models import HonoraryCertificate
class TestWithoutLogin(TestCase):
def setUp(self):
#this supress an unwanted warning about missing root dir
def test_set_granted(self):
'''test if the model function set_granted() works as intended'''
obj = HonoraryCertificate.objects.create(realname='hurzel',email='')
HonoraryCertificate.set_granted(, True)
obj2 = HonoraryCertificate.objects.get(
def test_source_link(self):
'''test if link to source code is included in main page'''
response = self.client.get('', follow=True)
#print (response.content)
self.assertContains(response,'<a href="">Sourcecode</a>')
def test_access_denied(self):
'''test if /intern redirects to login page if not logged in'''
response = self.client.get('/intern', follow=True)
class TestWithLogin(TestCase):
# fixture = ['testfixture']
def setUp(self):
User.objects.create_superuser('testuser', '', 'testpasswd')
def test_access(self):
'''test if /intern gives an answer'''
self.assertEqual(self.client.login(username='testuser', password='testpasswd'), True)
response = self.client.get('/intern')
self.assertContains(response,'Übersicht aller Förderangebote')