|
@ -1,10 +1,10 @@ |
|
|
from django.test import TestCase |
|
|
from django.test import TestCase |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
|
|
|
from django.contrib.auth.models import User |
|
|
|
|
|
|
|
|
from .models import HonoraryCertificate |
|
|
from .models import HonoraryCertificate |
|
|
|
|
|
|
|
|
# Create your tests here. |
|
|
|
|
|
class TestGranted(TestCase): |
|
|
|
|
|
|
|
|
class TestWithoutLogin(TestCase): |
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
def setUp(self): |
|
|
#this supress an unwanted warning about missing root dir |
|
|
#this supress an unwanted warning about missing root dir |
|
@ -28,3 +28,15 @@ class TestGranted(TestCase): |
|
|
'''test if /intern redirects to login page if not logged in''' |
|
|
'''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') |
|
|
|
|
|
|
|
|
|
|
|
class TestWithLogin(TestCase): |
|
|
|
|
|
# fixture = ['testfixture'] |
|
|
|
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
|
|
|
User.objects.create_superuser('testuser', 'nomail@nomail.com', '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') |