diff options
author | Theo Chatzimichos <tampakrap@gentoo.org> | 2013-08-21 22:58:26 +0200 |
---|---|---|
committer | Theo Chatzimichos <tampakrap@gentoo.org> | 2013-08-21 22:58:26 +0200 |
commit | da43a565f4b9a778d703ae31fdfd5f92384ef159 (patch) | |
tree | 564a194205e6d03bf9ec5d4f3d597b8aff069fef /okupy/common | |
parent | Add more attrs to the test accounts, for more testing (diff) | |
download | identity.gentoo.org-da43a565f4b9a778d703ae31fdfd5f92384ef159.tar.gz identity.gentoo.org-da43a565f4b9a778d703ae31fdfd5f92384ef159.tar.bz2 identity.gentoo.org-da43a565f4b9a778d703ae31fdfd5f92384ef159.zip |
Add support for negative queries in set_search_seed
Diffstat (limited to 'okupy/common')
-rw-r--r-- | okupy/common/test_helpers.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/okupy/common/test_helpers.py b/okupy/common/test_helpers.py index 81581c2..bac9293 100644 --- a/okupy/common/test_helpers.py +++ b/okupy/common/test_helpers.py @@ -51,14 +51,17 @@ def ldap_users(username=None, all=False, clean=False, return result -def set_search_seed(value=None, attr='uid'): +def set_search_seed(value=None, attr='uid', neg=False): """ Create the filterstr of the search_s seed part of the mocked ldap object """ search_item = '(&' for item in settings.AUTH_LDAP_USER_OBJECTCLASS: search_item += '(objectClass=%s)' % item if value: - search_item += '(%s=%s)' % (attr, value) + if neg: + search_item += '(!(%s=%s))' % (attr, value) + else: + search_item += '(%s=%s)' % (attr, value) return search_item + ')' |