-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved pseudo test script from module ldap.cidict to separate test sub…
…-module t_cidict.py
- Loading branch information
stroeder
committed
Aug 15, 2017
1 parent
a28837d
commit e2bdb37
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # -*- coding: utf-8 -*- | ||
| """ | ||
| Automatic tests for python-ldap's module ldap.cidict | ||
| See http://www.python-ldap.org/ for details. | ||
| $Id: t_cidict.py,v 1.1 2017/08/15 15:18:35 stroeder Exp $ | ||
| """ | ||
|
|
||
| # from Python's standard lib | ||
| import unittest | ||
|
|
||
| # from python-ldap | ||
| import ldap, ldap.cidict | ||
|
|
||
|
|
||
| class TestCidict(unittest.TestCase): | ||
| """ | ||
| test ldap.cidict.cidict | ||
| """ | ||
|
|
||
| def test_cidict(self): | ||
| """ | ||
| test function is_dn() | ||
| """ | ||
| self.assertEquals(ldap.dn.is_dn('foobar,ou=ae-dir'), False) | ||
| data = { | ||
| 'AbCDeF':123, | ||
| } | ||
| cix = ldap.cidict.cidict(data) | ||
| self.assertEquals(cix["ABCDEF"], 123) | ||
| self.assertEquals(cix.get("ABCDEF", None), 123) | ||
| self.assertEquals(cix.get("not existent", None), None) | ||
| cix["xYZ"] = 987 | ||
| self.assertEquals(cix["XyZ"], 987) | ||
| self.assertEquals(cix.get("xyz", None), 987) | ||
| cix_keys = cix.keys() | ||
| cix_keys.sort() | ||
| self.assertEquals(cix_keys, ['AbCDeF','xYZ']) | ||
| cix_items = cix.items() | ||
| cix_items.sort() | ||
| self.assertEquals(cix_items, [('AbCDeF',123), ('xYZ',987)]) | ||
| del cix["abcdEF"] | ||
| self.assertEquals(cix._keys.has_key("abcdef"), False) | ||
| self.assertEquals(cix._keys.has_key("AbCDef"), False) | ||
|
|
||
|
|
||
| if __name__ == '__main__': | ||
| unittest.main() |