diff --git a/helpdesk/tests/test_login.py b/helpdesk/tests/test_login.py index 8f28e962..800ae71d 100644 --- a/helpdesk/tests/test_login.py +++ b/helpdesk/tests/test_login.py @@ -35,3 +35,11 @@ class TestLoginRedirect(TestCase): """Test that default login is used when LOGIN_URL is None""" response = self.client.get(reverse('helpdesk:login')) self.assertTemplateUsed(response, 'helpdesk/registration/login.html') + + @override_settings(LOGIN_URL='admin:login', SITE_ID=1) + def test_custom_login_view_with_name(self): + """Test that LOGIN_URL can be a view name""" + response = self.client.get(reverse('helpdesk:login')) + home_url = reverse('helpdesk:home') + expected = reverse('admin:login') + "?next=" + home_url + self.assertRedirects(response, expected) diff --git a/helpdesk/tests/urls.py b/helpdesk/tests/urls.py index 12553ec3..640937c2 100644 --- a/helpdesk/tests/urls.py +++ b/helpdesk/tests/urls.py @@ -1,5 +1,7 @@ from django.conf.urls import include, url +from django.contrib import admin urlpatterns = [ url(r'^helpdesk/', include('helpdesk.urls', namespace='helpdesk')), + url(r'^admin/', admin.site.urls), ]