Fix missing import bug in UserAdmin, StateAdmin, add tests for those cases

This commit is contained in:
ErikKalkoken
2020-02-20 15:29:54 +01:00
parent cfa2cf58f3
commit 8290081365
6 changed files with 282 additions and 150 deletions

View File

@@ -4,7 +4,7 @@ from django.conf import settings
from django.contrib import admin
from django.contrib.admin.sites import AdminSite
from django.contrib.auth.models import User
from django.test import TestCase, RequestFactory
from django.test import TestCase, RequestFactory, Client
from allianceauth.authentication.models import CharacterOwnership, State
from allianceauth.eveonline.models import (
@@ -16,6 +16,7 @@ from ..admin import (
GroupAdmin,
Group
)
from . import get_admin_change_view_url
if 'allianceauth.eveonline.autogroups' in settings.INSTALLED_APPS:
_has_auto_groups = True
@@ -385,4 +386,12 @@ class TestGroupAdmin(TestCase):
self.group_3
]
self.assertSetEqual(set(queryset), set(expected))
def test_change_view_loads_normally(self):
User.objects.create_superuser(
username='superuser', password='secret', email='admin@example.com'
)
c = Client()
c.login(username='superuser', password='secret')
response = c.get(get_admin_change_view_url(self.group_1))
self.assertEqual(response.status_code, 200)