|
@ -1,8 +1,8 @@ |
|
|
from django.test import TestCase |
|
|
|
|
|
|
|
|
from django.test import TestCase, Client |
|
|
from django.conf import settings |
|
|
from django.conf import settings |
|
|
from django.contrib.auth.models import User |
|
|
from django.contrib.auth.models import User |
|
|
|
|
|
|
|
|
from .models import HonoraryCertificate |
|
|
|
|
|
|
|
|
from .models import HonoraryCertificate, Project, Account |
|
|
|
|
|
|
|
|
class TestWithoutLogin(TestCase): |
|
|
class TestWithoutLogin(TestCase): |
|
|
|
|
|
|
|
@ -29,14 +29,26 @@ class TestWithoutLogin(TestCase): |
|
|
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): |
|
|
class TestWithLogin(TestCase): |
|
|
# fixture = ['testfixture'] |
|
|
|
|
|
|
|
|
|
|
|
def setUp(self): |
|
|
def setUp(self): |
|
|
User.objects.create_superuser('testuser', 'nomail@nomail.com', 'testpasswd') |
|
|
User.objects.create_superuser('testuser', 'nomail@nomail.com', 'testpasswd') |
|
|
|
|
|
self.client = Client() |
|
|
|
|
|
self.user = User.objects.create_user('vladimir', 'vladimir@reiherzehe.com', 'reiherzehe') |
|
|
|
|
|
|
|
|
def test_access(self): |
|
|
def test_access(self): |
|
|
'''test if /intern gives an answer''' |
|
|
'''test if /intern gives an answer''' |
|
|
self.assertEqual(self.client.login(username='testuser', password='testpasswd'), True) |
|
|
self.assertEqual(self.client.login(username='testuser', password='testpasswd'), True) |
|
|
response = self.client.get('/intern') |
|
|
response = self.client.get('/intern') |
|
|
self.assertContains(response,'Übersicht aller Förderangebote') |
|
|
self.assertContains(response,'Übersicht aller Förderangebote') |
|
|
|
|
|
|
|
|
|
|
|
def test_project_pid(self): |
|
|
|
|
|
''' test if the project pid is resettet ad start of year''' |
|
|
|
|
|
# self.client.login(username='vladimir', password='reiherzehe') |
|
|
|
|
|
acc = Account.objects.create(code='1234', description='blabla') |
|
|
|
|
|
#acc.save() |
|
|
|
|
|
obj = Project.objects.create(account= acc, name='testproject', start='2022-01-01') |
|
|
|
|
|
#obj.save() |
|
|
|
|
|
print(obj.pid) |
|
|
|
|
|
self.assertEqual(True,True) |