Fix authentication app view tests.
This commit is contained in:
@@ -6,6 +6,7 @@ from django.core.urlresolvers import reverse
|
|||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
from django.test.client import Client
|
from django.test.client import Client
|
||||||
|
|
||||||
|
from organizations.tests.base import OrganizationTestCase
|
||||||
from user_management.tests.literals import (
|
from user_management.tests.literals import (
|
||||||
TEST_ADMIN_EMAIL, TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME
|
TEST_ADMIN_EMAIL, TEST_ADMIN_PASSWORD, TEST_ADMIN_USERNAME
|
||||||
)
|
)
|
||||||
@@ -13,18 +14,22 @@ from user_management.tests.literals import (
|
|||||||
from .literals import TEST_EMAIL_AUTHENTICATION_BACKEND
|
from .literals import TEST_EMAIL_AUTHENTICATION_BACKEND
|
||||||
|
|
||||||
|
|
||||||
class UserLoginTestCase(TestCase):
|
class UserLoginTestCase(OrganizationTestCase):
|
||||||
"""
|
"""
|
||||||
Test that users can login via the supported authentication methods
|
Test that users can login via the supported authentication methods
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
super(UserLoginTestCase, self).setUp()
|
||||||
self.admin_user = get_user_model().objects.create_superuser(
|
self.admin_user = get_user_model().objects.create_superuser(
|
||||||
username=TEST_ADMIN_USERNAME, email=TEST_ADMIN_EMAIL,
|
username=TEST_ADMIN_USERNAME, email=TEST_ADMIN_EMAIL,
|
||||||
password=TEST_ADMIN_PASSWORD
|
password=TEST_ADMIN_PASSWORD
|
||||||
)
|
)
|
||||||
self.client = Client()
|
self.client = Client()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
super(UserLoginTestCase, self).tearDown()
|
||||||
|
|
||||||
@override_settings(AUTHENTICATION_LOGIN_METHOD='username')
|
@override_settings(AUTHENTICATION_LOGIN_METHOD='username')
|
||||||
def test_normal_behaviour(self):
|
def test_normal_behaviour(self):
|
||||||
response = self.client.get(reverse('documents:document_list'))
|
response = self.client.get(reverse('documents:document_list'))
|
||||||
|
|||||||
Reference in New Issue
Block a user