From acabb2df54b29dd693f3b202c04c766661893a39 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 11 Mar 2019 11:44:12 +0100 Subject: [PATCH] fix unittests --- debian/changelog | 2 +- passbook/core/tests/test_views_utils.py | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index e5c74523d..31255e7db 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -passbook (0.1.13) stable; urgency=medium +passbook (0.1.14) stable; urgency=medium * bump version: 0.1.11-beta -> 0.1.12-beta * Fix DoesNotExist error when running PolicyEngine against None user diff --git a/passbook/core/tests/test_views_utils.py b/passbook/core/tests/test_views_utils.py index a9367fca4..f63a315b1 100644 --- a/passbook/core/tests/test_views_utils.py +++ b/passbook/core/tests/test_views_utils.py @@ -1,7 +1,10 @@ """passbook util view tests""" +import string +from random import SystemRandom from django.test import RequestFactory, TestCase +from passbook.core.models import User from passbook.core.views.utils import LoadingView, PermissionDeniedView @@ -9,6 +12,11 @@ class TestUtilViews(TestCase): """Test Utility Views""" def setUp(self): + self.user = User.objects.create_superuser( + username='unittest user', + email='unittest@example.com', + password=''.join(SystemRandom().choice( + string.ascii_uppercase + string.digits) for _ in range(8))) self.factory = RequestFactory() def test_loading_view(self): @@ -21,5 +29,6 @@ class TestUtilViews(TestCase): def test_permission_denied_view(self): """Test PermissionDeniedView""" request = self.factory.get('something') + request.user = self.user response = PermissionDeniedView.as_view()(request) self.assertEqual(response.status_code, 200)