diff options
author | 2013-09-13 12:59:47 +0200 | |
---|---|---|
committer | 2013-09-17 15:50:19 +0200 | |
commit | 3ea0caf9e043d356380c36fa2310f18746aea036 (patch) | |
tree | 290fee3c156a63972347ed971d0f3169e4001e2a | |
parent | Merge pull request #93 from dastergon/docs (diff) | |
download | identity.gentoo.org-3ea0caf9e043d356380c36fa2310f18746aea036.tar.gz identity.gentoo.org-3ea0caf9e043d356380c36fa2310f18746aea036.tar.bz2 identity.gentoo.org-3ea0caf9e043d356380c36fa2310f18746aea036.zip |
Require the database cleanup only to remove USER and PASSWORD.
Due to limitations in django, we can't really remove or replace settings
dictionary once connection is instantiated. Therefore, all the code
that's playing with it will simply modify the existing dict.
As a result, removing the connection will only remove username &
password, not the whole entry.
-rw-r--r-- | okupy/tests/unit/test_ldapuser.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/okupy/tests/unit/test_ldapuser.py b/okupy/tests/unit/test_ldapuser.py index 85097aa..7dd2b5f 100644 --- a/okupy/tests/unit/test_ldapuser.py +++ b/okupy/tests/unit/test_ldapuser.py @@ -95,7 +95,8 @@ class LDAPUserUnitTests(TestCase): self.assertRaises(ldap.INVALID_CREDENTIALS, get_bound_ldapuser, request, 'test') db_alias = 'ldap_%s' % request.session.cache_key - self.assertNotIn(db_alias, settings.DATABASES) + self.assertNotIn('USER', settings.DATABASES.get(db_alias, {})) + self.assertNotIn('PASSWORD', settings.DATABASES.get(db_alias, {})) def test_get_bound_ldapuser_context_manager_cleans_up_settings(self): secondary_password = Random.get_random_bytes(48) @@ -109,4 +110,5 @@ class LDAPUserUnitTests(TestCase): with get_bound_ldapuser(request) as user: # noqa pass db_alias = 'ldap_%s' % request.session.cache_key - self.assertNotIn(db_alias, settings.DATABASES) + self.assertNotIn('USER', settings.DATABASES.get(db_alias, {})) + self.assertNotIn('PASSWORD', settings.DATABASES.get(db_alias, {})) |