fix unittests

This commit is contained in:
Jens Langhammer 2019-03-11 11:44:12 +01:00
parent e6376a05f7
commit acabb2df54
2 changed files with 10 additions and 1 deletions

2
debian/changelog vendored
View file

@ -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

View file

@ -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)