[Freeipa-devel] [PATCH 24/24] Add utility classes for handling DN's along with their, unittest.

Rob Crittenden rcritten at redhat.com
Mon Jun 20 14:01:59 UTC 2011


John Dennis wrote:
> This adds a new module and set of classes to ipalib for handling DN's.
> Please see the module doc and class doc for full explanation.
>
> Included is a very complete unit test for the module. At close to 900
> lines of code the unit test exercises just about every conceivable way
> these objects can be used.
>
> The module doc touches on some of the problems found in our existing
> code which handles DN's, which this module is meant to provide fixes
> for. A more complete write-up of the existing code issues will follow on
> the list.
>
> Comments welcome of course.
>
> Another patch will follow for comma's in privileges. The
> test_role_plugin.py unit test was modified to introduce a comma, but
> there were many failures because of improper DN handling in the core
> code (as well as limitations of the unit test framework). The next patch
> introduces a number of fixes, some of which are dependent upon the use
> of the classes introduced here. With the fixes in the next patch the
> test_role_plugin unit test once again fully succeeds.
>

Am I misreading the documentation on how one can create a DN?

 >>> print container
cn=users,cn=accounts
 >>> print basedn
dc=example,dc=com
 >>> str(DN(container, basedn))
'cn=users,cn=accounts=dc\\=example\\,dc\\=com'
 >>> uid='rcrit'
 >>> rdnattr='uid'
 >>> str(DN('%s=%s' % (rdnattr, uid), container, basedn))
'uid=rcrit=cn\\=users\\,cn\\=accounts,dc=example,dc=com'

The patch requires one very minor change, the import from dn should be 
from ipalib.dn import ... We run the tests from the top-level.

rob




More information about the Freeipa-devel mailing list