mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 22:10:16 +02:00
Fix unit tests.
Discord still failing.
This commit is contained in:
parent
dd3a3e1081
commit
4bc91f2381
@ -170,7 +170,7 @@ CACHES = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AUTHENTICATION_BACKENDS = ['authentication.backends.StateBackend']
|
AUTHENTICATION_BACKENDS = ['authentication.backends.StateBackend', 'django.contrib.auth.backends.ModelBackend']
|
||||||
|
|
||||||
#####################################################
|
#####################################################
|
||||||
##
|
##
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div>
|
<div>
|
||||||
<h1 class="page-header">{% trans "Permissions Audit" %}: {{ permission.permission.codename }}</h1>
|
<h1 class="page-header">{% trans "Permissions Audit" %}: {{ permission.permission.codename }}</h1>
|
||||||
<a href="{% url 'permissions_overview' %}" class="btn btn-default">
|
<a href="{% url 'permissions_tool:overview' %}" class="btn btn-default">
|
||||||
<i class="glyphicon glyphicon-chevron-left"></i> {% trans "Back" %}
|
<i class="glyphicon glyphicon-chevron-left"></i> {% trans "Back" %}
|
||||||
</a>
|
</a>
|
||||||
<table class="table table-hover">
|
<table class="table table-hover">
|
||||||
|
@ -9,7 +9,7 @@ except ImportError:
|
|||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django import urls
|
from django import urls
|
||||||
from django.contrib.auth.models import User, Group, Permission
|
from django.contrib.auth.models import Group, Permission
|
||||||
|
|
||||||
from alliance_auth.tests.auth_utils import AuthUtils
|
from alliance_auth.tests.auth_utils import AuthUtils
|
||||||
|
|
||||||
@ -47,21 +47,20 @@ class PermissionsToolViewsTestCase(TestCase):
|
|||||||
AuthUtils.connect_signals()
|
AuthUtils.connect_signals()
|
||||||
|
|
||||||
def test_menu_item(self):
|
def test_menu_item(self):
|
||||||
self.client.login(username=self.member.username, password='password')
|
response = self.client.get(urls.reverse('permissions_tool:overview'))
|
||||||
|
|
||||||
response = self.client.get(urls.reverse('permissions_overview'))
|
|
||||||
|
|
||||||
response_content = response.content
|
response_content = response.content
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
response_content = str(response_content, encoding='utf8')
|
response_content = str(response_content, encoding='utf8')
|
||||||
|
|
||||||
self.assertInHTML('<li><a class="active" href="/en/permissions/overview/"><i class="fa fa-key fa-id-card '
|
self.assertInHTML(
|
||||||
'grayiconecolor"></i> Permissions Audit</a></li>', response_content)
|
'<li><a class="active" href="/permissions/overview/"><i class="fa fa-key fa-id-card grayiconecolor"></i> Permissions Audit</a></li>',
|
||||||
|
response_content)
|
||||||
|
|
||||||
def test_permissions_overview(self):
|
def test_permissions_overview(self):
|
||||||
self.client.login(username=self.member.username, password='password')
|
self.client.login(username=self.member.username, password='password')
|
||||||
|
|
||||||
response = self.client.get(urls.reverse('permissions_overview'))
|
response = self.client.get(urls.reverse('permissions_tool:overview'))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
self.assertTemplateUsed('permissions_tool/overview.html')
|
self.assertTemplateUsed('permissions_tool/overview.html')
|
||||||
@ -84,14 +83,14 @@ class PermissionsToolViewsTestCase(TestCase):
|
|||||||
# Ensure permission effectively denys access
|
# Ensure permission effectively denys access
|
||||||
self.client.login(username=self.no_perm_user.username, password='password')
|
self.client.login(username=self.no_perm_user.username, password='password')
|
||||||
|
|
||||||
response = self.client.get(urls.reverse('permissions_overview'))
|
response = self.client.get(urls.reverse('permissions_tool:overview'))
|
||||||
|
|
||||||
self.assertEqual(response.status_code, 302)
|
self.assertEqual(response.status_code, 302)
|
||||||
|
|
||||||
def test_permissions_audit(self):
|
def test_permissions_audit(self):
|
||||||
self.client.login(username=self.member.username, password='password')
|
self.client.login(username=self.member.username, password='password')
|
||||||
|
|
||||||
response = self.client.get(urls.reverse('permissions_audit',
|
response = self.client.get(urls.reverse('permissions_tool:audit',
|
||||||
kwargs={
|
kwargs={
|
||||||
'app_label': self.permission.content_type.app_label,
|
'app_label': self.permission.content_type.app_label,
|
||||||
'model': self.permission.content_type.model,
|
'model': self.permission.content_type.model,
|
||||||
@ -112,7 +111,7 @@ class PermissionsToolViewsTestCase(TestCase):
|
|||||||
# Ensure permission effectively denys access
|
# Ensure permission effectively denys access
|
||||||
self.client.login(username=self.no_perm_user.username, password='password')
|
self.client.login(username=self.no_perm_user.username, password='password')
|
||||||
|
|
||||||
response = self.client.get(urls.reverse('permissions_audit',
|
response = self.client.get(urls.reverse('permissions_tool:audit',
|
||||||
kwargs={
|
kwargs={
|
||||||
'app_label': self.permission.content_type.app_label,
|
'app_label': self.permission.content_type.app_label,
|
||||||
'model': self.permission.content_type.model,
|
'model': self.permission.content_type.model,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user