freeipa/tests
John Dennis 1328f984d0 Ticket #3008: DN objects hash differently depending on case
Because the attrs & values in DN's, RDN's and AVA's are comparison case-
insensitive the hash value between two objects which compare as equal but
differ in case must also yield the same hash value. This is critical when
these objects are used as a dict key or in a set because dicts and sets
use the object's __hash__ value in conjunction with the objects __eq__
method to lookup the object.

The defect is the DN, RDN & AVA objects computed their hash from the case-
preserving string representation thus two otherwise equal objects
incorrectly yielded different hash values.

The problem manifests itself when one of these objects is used as a key in
a dict, for example a dn.

dn1 = DN(('cn', 'Bob'))
dn2 = DN(('cn', 'bob'))

dn1 == dn2 --> True

hash(dn1) == hash(dn2) --> False

d = {}

d[dn1] = x
d[dn2] = y

len(d) --> 2

The patch fixes the above by lower casing the string representation of
the object prior to computing it's hash.

The patch also corrects a spelling mistake and a bogus return value in
ldapupdate.py which happened to be discovered while researching this
bug.
2012-08-22 17:23:12 +03:00
..
test_cmdline Use DN objects instead of strings 2012-08-12 16:23:24 -04:00
test_install Use DN objects instead of strings 2012-08-12 16:23:24 -04:00
test_ipalib Use DN objects instead of strings 2012-08-12 16:23:24 -04:00
test_ipapython Ticket #3008: DN objects hash differently depending on case 2012-08-22 17:23:12 +03:00
test_ipaserver Use DN objects instead of strings 2012-08-12 16:23:24 -04:00
test_pkcs10 Change FreeIPA license to GPLv3+ 2010-12-20 17:19:53 -05:00
test_xmlrpc Validate default user in ordered list when using setattr, require MLS 2012-08-16 12:52:38 +02:00
__init__.py Change FreeIPA license to GPLv3+ 2010-12-20 17:19:53 -05:00
data.py Change FreeIPA license to GPLv3+ 2010-12-20 17:19:53 -05:00
i18n.py Arrange stripping .po files 2012-07-24 16:54:21 -04:00
test_util.py Sort lists so order is predictable and tests pass as expected. 2011-08-31 11:18:08 +02:00
util.py Use DN objects instead of strings 2012-08-12 16:23:24 -04:00