From 3132bc9647c40208611a8760363701f73182d033 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Tue, 24 Nov 2020 11:12:04 +0100 Subject: [PATCH] basic login test, fixture deleted (no longer needed) --- foerderbarometer/fixtures/testfixture | 1 - input/templates/input/extern.html | 2 +- input/tests.py | 16 ++++++++++++++-- 3 files changed, 15 insertions(+), 4 deletions(-) delete mode 100644 foerderbarometer/fixtures/testfixture diff --git a/foerderbarometer/fixtures/testfixture b/foerderbarometer/fixtures/testfixture deleted file mode 100644 index 54bd115..0000000 --- a/foerderbarometer/fixtures/testfixture +++ /dev/null @@ -1 +0,0 @@ -[{"model": "auth.permission", "pk": 1, "fields": {"name": "Can add project", "content_type": 1, "codename": "add_project"}}, {"model": "auth.permission", "pk": 2, "fields": {"name": "Can change project", "content_type": 1, "codename": "change_project"}}, {"model": "auth.permission", "pk": 3, "fields": {"name": "Can delete project", "content_type": 1, "codename": "delete_project"}}, {"model": "auth.permission", "pk": 4, "fields": {"name": "Can view project", "content_type": 1, "codename": "view_project"}}, {"model": "auth.permission", "pk": 5, "fields": {"name": "Can add honorary certificate", "content_type": 2, "codename": "add_honorarycertificate"}}, {"model": "auth.permission", "pk": 6, "fields": {"name": "Can change honorary certificate", "content_type": 2, "codename": "change_honorarycertificate"}}, {"model": "auth.permission", "pk": 7, "fields": {"name": "Can delete honorary certificate", "content_type": 2, "codename": "delete_honorarycertificate"}}, {"model": "auth.permission", "pk": 8, "fields": {"name": "Can view honorary certificate", "content_type": 2, "codename": "view_honorarycertificate"}}, {"model": "auth.permission", "pk": 9, "fields": {"name": "Can add library", "content_type": 3, "codename": "add_library"}}, {"model": "auth.permission", "pk": 10, "fields": {"name": "Can change library", "content_type": 3, "codename": "change_library"}}, {"model": "auth.permission", "pk": 11, "fields": {"name": "Can delete library", "content_type": 3, "codename": "delete_library"}}, {"model": "auth.permission", "pk": 12, "fields": {"name": "Can view library", "content_type": 3, "codename": "view_library"}}, {"model": "auth.permission", "pk": 13, "fields": {"name": "Can add ifg", "content_type": 4, "codename": "add_ifg"}}, {"model": "auth.permission", "pk": 14, "fields": {"name": "Can change ifg", "content_type": 4, "codename": "change_ifg"}}, {"model": "auth.permission", "pk": 15, "fields": {"name": "Can delete ifg", "content_type": 4, "codename": "delete_ifg"}}, {"model": "auth.permission", "pk": 16, "fields": {"name": "Can view ifg", "content_type": 4, "codename": "view_ifg"}}, {"model": "auth.permission", "pk": 17, "fields": {"name": "Can add travel", "content_type": 5, "codename": "add_travel"}}, {"model": "auth.permission", "pk": 18, "fields": {"name": "Can change travel", "content_type": 5, "codename": "change_travel"}}, {"model": "auth.permission", "pk": 19, "fields": {"name": "Can delete travel", "content_type": 5, "codename": "delete_travel"}}, {"model": "auth.permission", "pk": 20, "fields": {"name": "Can view travel", "content_type": 5, "codename": "view_travel"}}, {"model": "auth.permission", "pk": 21, "fields": {"name": "Can add business card", "content_type": 6, "codename": "add_businesscard"}}, {"model": "auth.permission", "pk": 22, "fields": {"name": "Can change business card", "content_type": 6, "codename": "change_businesscard"}}, {"model": "auth.permission", "pk": 23, "fields": {"name": "Can delete business card", "content_type": 6, "codename": "delete_businesscard"}}, {"model": "auth.permission", "pk": 24, "fields": {"name": "Can view business card", "content_type": 6, "codename": "view_businesscard"}}, {"model": "auth.permission", "pk": 25, "fields": {"name": "Can add email", "content_type": 7, "codename": "add_email"}}, {"model": "auth.permission", "pk": 26, "fields": {"name": "Can change email", "content_type": 7, "codename": "change_email"}}, {"model": "auth.permission", "pk": 27, "fields": {"name": "Can delete email", "content_type": 7, "codename": "delete_email"}}, {"model": "auth.permission", "pk": 28, "fields": {"name": "Can view email", "content_type": 7, "codename": "view_email"}}, {"model": "auth.permission", "pk": 29, "fields": {"name": "Can add list", "content_type": 8, "codename": "add_list"}}, {"model": "auth.permission", "pk": 30, "fields": {"name": "Can change list", "content_type": 8, "codename": "change_list"}}, {"model": "auth.permission", "pk": 31, "fields": {"name": "Can delete list", "content_type": 8, "codename": "delete_list"}}, {"model": "auth.permission", "pk": 32, "fields": {"name": "Can view list", "content_type": 8, "codename": "view_list"}}, {"model": "auth.permission", "pk": 33, "fields": {"name": "Can add literature", "content_type": 9, "codename": "add_literature"}}, {"model": "auth.permission", "pk": 34, "fields": {"name": "Can change literature", "content_type": 9, "codename": "change_literature"}}, {"model": "auth.permission", "pk": 35, "fields": {"name": "Can delete literature", "content_type": 9, "codename": "delete_literature"}}, {"model": "auth.permission", "pk": 36, "fields": {"name": "Can view literature", "content_type": 9, "codename": "view_literature"}}, {"model": "auth.permission", "pk": 37, "fields": {"name": "Can add log entry", "content_type": 10, "codename": "add_logentry"}}, {"model": "auth.permission", "pk": 38, "fields": {"name": "Can change log entry", "content_type": 10, "codename": "change_logentry"}}, {"model": "auth.permission", "pk": 39, "fields": {"name": "Can delete log entry", "content_type": 10, "codename": "delete_logentry"}}, {"model": "auth.permission", "pk": 40, "fields": {"name": "Can view log entry", "content_type": 10, "codename": "view_logentry"}}, {"model": "auth.permission", "pk": 41, "fields": {"name": "Can add permission", "content_type": 11, "codename": "add_permission"}}, {"model": "auth.permission", "pk": 42, "fields": {"name": "Can change permission", "content_type": 11, "codename": "change_permission"}}, {"model": "auth.permission", "pk": 43, "fields": {"name": "Can delete permission", "content_type": 11, "codename": "delete_permission"}}, {"model": "auth.permission", "pk": 44, "fields": {"name": "Can view permission", "content_type": 11, "codename": "view_permission"}}, {"model": "auth.permission", "pk": 45, "fields": {"name": "Can add group", "content_type": 12, "codename": "add_group"}}, {"model": "auth.permission", "pk": 46, "fields": {"name": "Can change group", "content_type": 12, "codename": "change_group"}}, {"model": "auth.permission", "pk": 47, "fields": {"name": "Can delete group", "content_type": 12, "codename": "delete_group"}}, {"model": "auth.permission", "pk": 48, "fields": {"name": "Can view group", "content_type": 12, "codename": "view_group"}}, {"model": "auth.permission", "pk": 49, "fields": {"name": "Can add user", "content_type": 13, "codename": "add_user"}}, {"model": "auth.permission", "pk": 50, "fields": {"name": "Can change user", "content_type": 13, "codename": "change_user"}}, {"model": "auth.permission", "pk": 51, "fields": {"name": "Can delete user", "content_type": 13, "codename": "delete_user"}}, {"model": "auth.permission", "pk": 52, "fields": {"name": "Can view user", "content_type": 13, "codename": "view_user"}}, {"model": "auth.permission", "pk": 53, "fields": {"name": "Can add content type", "content_type": 14, "codename": "add_contenttype"}}, {"model": "auth.permission", "pk": 54, "fields": {"name": "Can change content type", "content_type": 14, "codename": "change_contenttype"}}, {"model": "auth.permission", "pk": 55, "fields": {"name": "Can delete content type", "content_type": 14, "codename": "delete_contenttype"}}, {"model": "auth.permission", "pk": 56, "fields": {"name": "Can view content type", "content_type": 14, "codename": "view_contenttype"}}, {"model": "auth.permission", "pk": 57, "fields": {"name": "Can add session", "content_type": 15, "codename": "add_session"}}, {"model": "auth.permission", "pk": 58, "fields": {"name": "Can change session", "content_type": 15, "codename": "change_session"}}, {"model": "auth.permission", "pk": 59, "fields": {"name": "Can delete session", "content_type": 15, "codename": "delete_session"}}, {"model": "auth.permission", "pk": 60, "fields": {"name": "Can view session", "content_type": 15, "codename": "view_session"}}, {"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$216000$d45Fsa4wgwAx$QZ3Jfl3pqtYZYgHugf8Tlok0YHz2DV2vs//u2aI5X58=", "last_login": "2020-11-24T09:13:44.891Z", "is_superuser": true, "username": "testuser", "first_name": "", "last_name": "", "email": "", "is_staff": true, "is_active": true, "date_joined": "2020-11-24T09:13:22.716Z", "groups": [], "user_permissions": []}}, {"model": "contenttypes.contenttype", "pk": 1, "fields": {"app_label": "input", "model": "project"}}, {"model": "contenttypes.contenttype", "pk": 2, "fields": {"app_label": "input", "model": "honorarycertificate"}}, {"model": "contenttypes.contenttype", "pk": 3, "fields": {"app_label": "input", "model": "library"}}, {"model": "contenttypes.contenttype", "pk": 4, "fields": {"app_label": "input", "model": "ifg"}}, {"model": "contenttypes.contenttype", "pk": 5, "fields": {"app_label": "input", "model": "travel"}}, {"model": "contenttypes.contenttype", "pk": 6, "fields": {"app_label": "input", "model": "businesscard"}}, {"model": "contenttypes.contenttype", "pk": 7, "fields": {"app_label": "input", "model": "email"}}, {"model": "contenttypes.contenttype", "pk": 8, "fields": {"app_label": "input", "model": "list"}}, {"model": "contenttypes.contenttype", "pk": 9, "fields": {"app_label": "input", "model": "literature"}}, {"model": "contenttypes.contenttype", "pk": 10, "fields": {"app_label": "admin", "model": "logentry"}}, {"model": "contenttypes.contenttype", "pk": 11, "fields": {"app_label": "auth", "model": "permission"}}, {"model": "contenttypes.contenttype", "pk": 12, "fields": {"app_label": "auth", "model": "group"}}, {"model": "contenttypes.contenttype", "pk": 13, "fields": {"app_label": "auth", "model": "user"}}, {"model": "contenttypes.contenttype", "pk": 14, "fields": {"app_label": "contenttypes", "model": "contenttype"}}, {"model": "contenttypes.contenttype", "pk": 15, "fields": {"app_label": "sessions", "model": "session"}}] \ No newline at end of file diff --git a/input/templates/input/extern.html b/input/templates/input/extern.html index 30faa8a..cfffff4 100644 --- a/input/templates/input/extern.html +++ b/input/templates/input/extern.html @@ -56,7 +56,7 @@ Du hast {{choice}} ausgewählt.

-Eine Übersicht alle Förderangebote von Wikimedia Deutschland findest du im +Eine Übersicht aller Förderangebote von Wikimedia Deutschland findest du im Förderportal in der deutschsprachigen Wikipedia.
Für alle Fragen wende dich gern an das Team Ideenförderung.

diff --git a/input/tests.py b/input/tests.py index 8b6de2e..09bd73a 100644 --- a/input/tests.py +++ b/input/tests.py @@ -1,10 +1,10 @@ from django.test import TestCase from django.conf import settings +from django.contrib.auth.models import User from .models import HonoraryCertificate -# Create your tests here. -class TestGranted(TestCase): +class TestWithoutLogin(TestCase): def setUp(self): #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''' response = self.client.get('/intern', follow=True) 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')