mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-18 14:00:59 +00:00
Added failing test for #431
This commit is contained in:
parent
d8979570ba
commit
92818ddbd6
1 changed files with 20 additions and 1 deletions
|
|
@ -6,7 +6,7 @@ from django.contrib.auth.models import User, Group, Permission
|
|||
from django.contrib.auth.tokens import PasswordResetTokenGenerator
|
||||
from django.core import mail
|
||||
|
||||
from wagtail.tests.utils import WagtailTestUtils
|
||||
from wagtail.tests.utils import unittest, WagtailTestUtils
|
||||
from wagtail.wagtailusers.models import UserProfile
|
||||
|
||||
|
||||
|
|
@ -65,6 +65,25 @@ class TestAuthentication(TestCase, WagtailTestUtils):
|
|||
# Check that the user was redirected to the dashboard
|
||||
self.assertRedirects(response, reverse('wagtailadmin_home'))
|
||||
|
||||
@unittest.expectedFailure
|
||||
def test_logged_in_as_non_privilaged_user_doesnt_redirect(self):
|
||||
"""
|
||||
This tests that if the user is logged in but hasn't got permission
|
||||
to access the admin, they are not redirected to the admin
|
||||
|
||||
This tests issue #431
|
||||
"""
|
||||
# Login as unprivilaged user
|
||||
User.objects.create(username='unprivilaged', password='123')
|
||||
self.client.login(username='unprivilaged', password='123')
|
||||
|
||||
# Get login page
|
||||
response = self.client.get(reverse('wagtailadmin_login'))
|
||||
|
||||
# Check that the user recieved a login page and was not redirected
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertTemplateUsed(response, 'wagtailadmin/login.html')
|
||||
|
||||
def test_logout(self):
|
||||
"""
|
||||
This tests that the user can logout
|
||||
|
|
|
|||
Loading…
Reference in a new issue