aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2013-09-22 10:55:25 -0700
committerMichał Górny <mgorny@gentoo.org>2013-09-22 10:55:25 -0700
commitde128ee24c46c6b5408a9197ed0c293800796a47 (patch)
tree9ab8da831e43bbeae6e7e35a815f95daa321d22d /okupy/tests/unit/test_login.py
parentMerge pull request #99 from dastergon/minor_fixes (diff)
parentAdd tests for LDAPAuthBackend. (diff)
downloadidentity.gentoo.org-de128ee24c46c6b5408a9197ed0c293800796a47.tar.gz
identity.gentoo.org-de128ee24c46c6b5408a9197ed0c293800796a47.tar.bz2
identity.gentoo.org-de128ee24c46c6b5408a9197ed0c293800796a47.zip
Merge pull request #92 from mgorny/no-django_ldap_auth
Replace django_auth_ldap with own backend
Diffstat (limited to 'okupy/tests/unit/test_login.py')
-rw-r--r--okupy/tests/unit/test_login.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/okupy/tests/unit/test_login.py b/okupy/tests/unit/test_login.py
index f781741..c9948db 100644
--- a/okupy/tests/unit/test_login.py
+++ b/okupy/tests/unit/test_login.py
@@ -52,7 +52,7 @@ class LoginUnitTests(OkupyTestCase):
@no_database()
@override_settings(AUTHENTICATION_BACKENDS=(
- 'django_auth_ldap.backend.LDAPBackend',
+ 'okupy.common.auth.LDAPAuthBackend',
'django.contrib.auth.backends.ModelBackend'))
def test_no_database_raises_critical(self):
request = set_request(uri='/login', post=vars.LOGIN_ALICE,
@@ -64,7 +64,7 @@ class LoginUnitTests(OkupyTestCase):
@no_database()
@override_settings(AUTHENTICATION_BACKENDS=(
- 'django_auth_ldap.backend.LDAPBackend',
+ 'okupy.common.auth.LDAPAuthBackend',
'django.contrib.auth.backends.ModelBackend'))
def test_no_database_sends_notification_mail(self):
request = set_request(uri='/login', post=vars.LOGIN_ALICE,
@@ -144,17 +144,20 @@ class LoginUnitTestsNoLDAP(OkupyTestCase):
self.assertMessage(response, 'Login failed', 40)
def test_dont_authenticate_from_db_when_ldap_is_down(self):
- request = set_request(uri='/login', post=vars.LOGIN_BOB, messages=True)
+ request = set_request(uri='/login', post=vars.LOGIN_BOB,
+ messages=True)
response = login(request)
response.context = RequestContext(request)
- self.assertMessage(response, 'Login failed', 40)
+ self.assertMessage(response,
+ "Can't contact the LDAP server or the database", 40)
- def test_no_ldap_connection_raises_login_failed_in_login(self):
+ def test_no_ldap_connection_raises_ldaperror_in_login(self):
request = set_request(uri='/login', post=vars.LOGIN_WRONG,
messages=True)
response = login(request)
response.context = RequestContext(request)
- self.assertMessage(response, 'Login failed', 40)
+ self.assertMessage(response,
+ "Can't contact the LDAP server or the database", 40)
def test_no_ldap_connection_in_logout_sends_notification_mail(self):
request = set_request(uri='/login', post=vars.LOGIN_ALICE,