<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[12337] twext/trunk/twext/who/ldap</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/12337">12337</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2014-01-14 12:30:17 -0800 (Tue, 14 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Some basic queries work now.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#twexttrunktwextwholdap_constantspy">twext/trunk/twext/who/ldap/_constants.py</a></li>
<li><a href="#twexttrunktwextwholdap_servicepy">twext/trunk/twext/who/ldap/_service.py</a></li>
<li><a href="#twexttrunktwextwholdaptesttest_servicepy">twext/trunk/twext/who/ldap/test/test_service.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="twexttrunktwextwholdap_constantspy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/who/ldap/_constants.py (12336 => 12337)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/who/ldap/_constants.py        2014-01-14 20:29:48 UTC (rev 12336)
+++ twext/trunk/twext/who/ldap/_constants.py        2014-01-14 20:30:17 UTC (rev 12337)
</span><span class="lines">@@ -22,10 +22,8 @@
</span><span class="cx">     Names, NamedConstant, Values, ValueConstant
</span><span class="cx"> )
</span><span class="cx"> 
</span><del>-from ..idirectory import (
-    FieldName as BaseFieldName, RecordType as BaseRecordType
-)
</del><span class="cx"> from ..expression import MatchType
</span><ins>+from ..util import ConstantsContainer
</ins><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -119,25 +117,25 @@
</span><span class="cx">     See U{RFC 4519, section 2&lt;http://tools.ietf.org/html/rfc4519#section-2&gt;}.
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     businessCategory = ValueConstant(u&quot;businessCategory&quot;)
</span><del>-    countryName = ValueConstant(u&quot;c&quot;)
-    commonName = ValueConstant(u&quot;cn&quot;)
-    domainComponent = ValueConstant(u&quot;dc&quot;)
</del><ins>+    c = ValueConstant(u&quot;c&quot;)  # country name
+    cn = ValueConstant(u&quot;cn&quot;)  # common name
+    domainComponent = ValueConstant(u&quot;dc&quot;)  # domain component
</ins><span class="cx">     description = ValueConstant(u&quot;description&quot;)
</span><span class="cx">     destinationIndicator = ValueConstant(u&quot;destinationIndicator&quot;)
</span><span class="cx">     distinguishedName = ValueConstant(u&quot;distinguishedName&quot;)
</span><span class="cx">     dnQualifier = ValueConstant(u&quot;dnQualifier&quot;)
</span><del>-    enhancedSearchGuide = ValueConstant(u&quot;enhanced search guide&quot;)
</del><ins>+    enhancedSearchGuide = ValueConstant(u&quot;enhancedSearchGuide&quot;)
</ins><span class="cx">     facsimileTelephoneNumber = ValueConstant(u&quot;facsimileTelephoneNumber&quot;)
</span><span class="cx">     generationQualifier = ValueConstant(u&quot;generationQualifier&quot;)
</span><span class="cx">     givenName = ValueConstant(u&quot;givenName&quot;)
</span><span class="cx">     houseIdentifier = ValueConstant(u&quot;houseIdentifier&quot;)
</span><span class="cx">     initials = ValueConstant(u&quot;initials&quot;)
</span><span class="cx">     internationalISDNNumber = ValueConstant(u&quot;internationalISDNNumber&quot;)
</span><del>-    localityName = ValueConstant(u&quot;l&quot;)
</del><ins>+    l = ValueConstant(u&quot;l&quot;)  # location name
</ins><span class="cx">     member = ValueConstant(u&quot;member&quot;)
</span><span class="cx">     name = ValueConstant(u&quot;name&quot;)
</span><del>-    organizationName = ValueConstant(u&quot;o&quot;)
-    organizationalUnitName = ValueConstant(u&quot;ou&quot;)
</del><ins>+    o = ValueConstant(u&quot;o&quot;)  # organization name
+    ou = ValueConstant(u&quot;ou&quot;)  # organizational unit name
</ins><span class="cx">     owner = ValueConstant(u&quot;owner&quot;)
</span><span class="cx">     physicalDeliveryOfficeName = ValueConstant(u&quot;physicalDeliveryOfficeName&quot;)
</span><span class="cx">     postalAddress = ValueConstant(u&quot;postalAddress&quot;)
</span><span class="lines">@@ -149,25 +147,21 @@
</span><span class="cx">     searchGuide = ValueConstant(u&quot;searchGuide&quot;)
</span><span class="cx">     seeAlso = ValueConstant(u&quot;seeAlso&quot;)
</span><span class="cx">     serialNumber = ValueConstant(u&quot;serialNumber&quot;)
</span><del>-    surname = ValueConstant(u&quot;sn&quot;)
-    stateOrProvinceName = ValueConstant(u&quot;st&quot;)
</del><ins>+    sn = ValueConstant(u&quot;sn&quot;)  # surname
+    st = ValueConstant(u&quot;st&quot;)  # state or province name
</ins><span class="cx">     street = ValueConstant(u&quot;street&quot;)
</span><span class="cx">     telephoneNumber = ValueConstant(u&quot;telephoneNumber&quot;)
</span><span class="cx">     teletexTerminalIdentifier = ValueConstant(u&quot;teletexTerminalIdentifier&quot;)
</span><span class="cx">     telexNumber = ValueConstant(u&quot;telexNumber&quot;)
</span><span class="cx">     title = ValueConstant(u&quot;title&quot;)
</span><del>-    userID = ValueConstant(u&quot;uid&quot;)
</del><ins>+    uid = ValueConstant(u&quot;uid&quot;)  # user id
</ins><span class="cx">     uniqueMember = ValueConstant(u&quot;uniqueMember&quot;)
</span><span class="cx">     userPassword = ValueConstant(u&quot;userPassword&quot;)
</span><span class="cx">     x121Address = ValueConstant(u&quot;x121Address&quot;)
</span><span class="cx">     x500UniqueIdentifier = ValueConstant(u&quot;x500UniqueIdentifier&quot;)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-for c in RFC4519Attribute.iterconstants():
-    if c.name != c.value:
-        setattr(RFC4519Attribute, c.value, c)
</del><span class="cx"> 
</span><del>-
</del><span class="cx"> class RFC4519ObjectClass(Values):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     See U{RFC 4519, section 3&lt;http://tools.ietf.org/html/rfc4519#section-2&gt;}.
</span><span class="lines">@@ -188,28 +182,30 @@
</span><span class="cx">     uidObject = ValueConstant(u&quot;uidObject&quot;)
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-# http://tools.ietf.org/html/rfc4524
-# http://tools.ietf.org/html/rfc3112 auth schemes
-# http://tools.ietf.org/html/rfc2307
-# http://tools.ietf.org/html/rfc2798
-# http://tools.ietf.org/html/rfc2739 calendar
</del><span class="cx"> 
</span><ins>+class WhoAttribute(Values):
+    &quot;&quot;&quot;
+    Attributes needed internally that have no standard name.
+    &quot;&quot;&quot;
+    who_uid = ValueConstant(u&quot;__who_uid&quot;)
+    generatedUUID = ValueConstant(u&quot;__who_guid&quot;)
+    objectClass = ValueConstant(u&quot;__who_objectClass&quot;)
+    mail = ValueConstant(u&quot;__who_mail&quot;)
</ins><span class="cx"> 
</span><span class="cx"> 
</span><del>-# Maps field name -&gt; LDAP attribute name
-DEFAULT_FIELDNAME_MAP = {
-    BaseFieldName.uid: u&quot;uid&quot;,  # FIXME
-    BaseFieldName.guid: u&quot;entryUUID&quot;,  # FIXME
-    BaseFieldName.recordType: u&quot;objectClass&quot;,
-    BaseFieldName.shortNames: RFC4519Attribute.userID.value,
-    BaseFieldName.fullNames: RFC4519Attribute.commonName.value,
-    BaseFieldName.emailAddresses: u&quot;mail&quot;,  # FIXME
-    BaseFieldName.password: u&quot;userPassword&quot;,  # FIXME
-}
</del><span class="cx"> 
</span><ins>+LDAPAttribute = ConstantsContainer((
+    RFC4519Attribute,
+    WhoAttribute,
+))
</ins><span class="cx"> 
</span><del>-# Maps record type -&gt; LDAP organizational unit name
-DEFAULT_RECORDTYPE_MAP = {
-    BaseRecordType.user: u&quot;People&quot;,  # FIXME
-    BaseRecordType.group: u&quot;Group&quot;,  # FIXME
-}
</del><ins>+LDAPObjectClass = ConstantsContainer((
+    RFC4519ObjectClass,
+))
+
+
+# http://tools.ietf.org/html/rfc4524
+# http://tools.ietf.org/html/rfc3112 auth schemes
+# http://tools.ietf.org/html/rfc2307
+# http://tools.ietf.org/html/rfc2798
+# http://tools.ietf.org/html/rfc2739 calendar
</ins></span></pre></div>
<a id="twexttrunktwextwholdap_servicepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/who/ldap/_service.py (12336 => 12337)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/who/ldap/_service.py        2014-01-14 20:29:48 UTC (rev 12336)
+++ twext/trunk/twext/who/ldap/_service.py        2014-01-14 20:30:17 UTC (rev 12337)
</span><span class="lines">@@ -21,6 +21,8 @@
</span><span class="cx"> LDAP directory service implementation.
</span><span class="cx"> &quot;&quot;&quot;
</span><span class="cx"> 
</span><ins>+from uuid import UUID
+
</ins><span class="cx"> import ldap
</span><span class="cx"> 
</span><span class="cx"> # from zope.interface import implementer
</span><span class="lines">@@ -36,7 +38,7 @@
</span><span class="cx">     DirectoryServiceError, DirectoryAvailabilityError,
</span><span class="cx">     # InvalidDirectoryRecordError,
</span><span class="cx">     # QueryNotSupportedError,
</span><del>-    # FieldName as BaseFieldName,
</del><ins>+    FieldName as BaseFieldName,
</ins><span class="cx">     RecordType as BaseRecordType,
</span><span class="cx">     # IPlaintextPasswordVerifier, IHTTPDigestVerifier,
</span><span class="cx"> )
</span><span class="lines">@@ -52,7 +54,7 @@
</span><span class="cx">     # iterFlags,
</span><span class="cx">     ConstantsContainer,
</span><span class="cx"> )
</span><del>-from ._constants import DEFAULT_FIELDNAME_MAP, DEFAULT_RECORDTYPE_MAP
</del><ins>+from ._constants import LDAPAttribute, LDAPObjectClass
</ins><span class="cx"> from ._util import (
</span><span class="cx">     ldapQueryStringFromMatchExpression,
</span><span class="cx">     ldapQueryStringFromCompoundExpression,
</span><span class="lines">@@ -61,6 +63,27 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+# Maps field name -&gt; LDAP attribute name
+# FIXME: Use constants
+DEFAULT_FIELDNAME_MAP = {
+    BaseFieldName.uid: LDAPAttribute.who_uid.value,
+    BaseFieldName.guid: LDAPAttribute.generatedUUID.value,
+    BaseFieldName.recordType: LDAPAttribute.objectClass.value,
+    BaseFieldName.shortNames: LDAPAttribute.uid.value,
+    BaseFieldName.fullNames: LDAPAttribute.cn.value,
+    BaseFieldName.emailAddresses: LDAPAttribute.mail.value,
+    BaseFieldName.password: LDAPAttribute.userPassword.value,
+}
+
+
+# Maps record type -&gt; LDAP object class name
+DEFAULT_RECORDTYPE_MAP = {
+    BaseRecordType.user: LDAPObjectClass.person.value,
+    BaseRecordType.group: LDAPObjectClass.groupOfUniqueNames.value,
+}
+
+
+
</ins><span class="cx"> #
</span><span class="cx"> # Exceptions
</span><span class="cx"> #
</span><span class="lines">@@ -76,6 +99,13 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+class LDAPConfigurationError(ValueError):
+    &quot;&quot;&quot;
+    LDAP configuration error.
+    &quot;&quot;&quot;
+
+
+
</ins><span class="cx"> class LDAPConnectionError(DirectoryAvailabilityError):
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx">     LDAP connection error.
</span><span class="lines">@@ -134,8 +164,9 @@
</span><span class="cx">         tlsCACertificateDirectory=None,
</span><span class="cx">         useTLS=False,
</span><span class="cx">         debug=False,
</span><del>-        fieldNameMap=DEFAULT_FIELDNAME_MAP,
-        recordTypeMap=DEFAULT_RECORDTYPE_MAP,
</del><ins>+        fieldNameToAttributeMap=DEFAULT_FIELDNAME_MAP,
+        recordTypeToObjectClassMap=DEFAULT_RECORDTYPE_MAP,
+        uidField=BaseFieldName.uid,
</ins><span class="cx">     ):
</span><span class="cx">         self.url = url
</span><span class="cx">         self._baseDN = baseDN
</span><span class="lines">@@ -159,10 +190,29 @@
</span><span class="cx">         else:
</span><span class="cx">             self._debug = None
</span><span class="cx"> 
</span><del>-        self._fieldNameMap = fieldNameMap
-        self._recordTypeMap = recordTypeMap
</del><ins>+        def reverseDict(source):
+            new = {}
</ins><span class="cx"> 
</span><ins>+            for k, v in source.iteritems():
+                if v in new:
+                    raise LDAPConfigurationError(
+                        u&quot;Field name map has duplicate values: {0}&quot;.format(v)
+                    )
+                new[v] = k
</ins><span class="cx"> 
</span><ins>+            return new
+
+        self._fieldNameToAttributeMap = fieldNameToAttributeMap
+        self._attributeToFieldNameMap = reverseDict(fieldNameToAttributeMap)
+
+        self._recordTypeToObjectClassMap = recordTypeToObjectClassMap
+        self._objectClassToRecordTypeMap = reverseDict(
+            recordTypeToObjectClassMap
+        )
+
+        self._uidField = uidField
+
+
</ins><span class="cx">     @property
</span><span class="cx">     def realmName(self):
</span><span class="cx">         return u&quot;{self.url}&quot;.format(self=self)
</span><span class="lines">@@ -236,28 +286,90 @@
</span><span class="cx">     def _recordsFromQueryString(self, queryString):
</span><span class="cx">         connection = yield self._connect()
</span><span class="cx"> 
</span><del>-        # print(&quot;+&quot; * 80)
-        # print(&quot;Query:&quot;, repr(queryString))
</del><ins>+        self.log.debug(&quot;Performing LDAP query: {query}&quot;, query=queryString)
</ins><span class="cx"> 
</span><span class="cx">         reply = connection.search_s(
</span><span class="cx">             self._baseDN, ldap.SCOPE_SUBTREE, queryString  # attrs
</span><span class="cx">         )
</span><span class="cx"> 
</span><del>-        # print(&quot;Reply:&quot;, repr(reply))
-        # print(&quot;+&quot; * 80)
-
</del><span class="cx">         records = []
</span><span class="cx"> 
</span><del>-        for recordData in reply:
-            raise NotImplementedError(reply)
</del><ins>+        # Note: self._uidField is the name of the field in
+        # self._fieldNameToAttributeMap that tells us which LDAP attribute
+        # we are using to determine the UID of the record.
</ins><span class="cx"> 
</span><ins>+        uidField = self.fieldName.uid
+        uidAttribute = self._fieldNameToAttributeMap[self._uidField]
+
+        recordTypeField = self.fieldName.recordType
+        recordTypeAttribute = (
+            self._fieldNameToAttributeMap[self.fieldName.recordType]
+        )
+
+        for dn, recordData in reply:
+
+            if recordTypeAttribute not in recordData:
+                self.log.debug(
+                    &quot;Ignoring LDAP record data with no record type attribute &quot;
+                    &quot;{source.fieldName.recordType!r}: {recordData!r}&quot;,
+                    self=self, recordData=recordData
+                )
+                continue
+
+            # Make a dict of fields -&gt; values from the incoming dict of
+            # attributes -&gt; values.
+
+            fields = dict([
+                (self._attributeToFieldNameMap[k], v)
+                for k, v in recordData.iteritems()
+            ])
+
+            # Make sure the UID is populated
+
+            try:
+                fields[uidField] = recordData[uidAttribute]
+            except KeyError:
+                self.log.debug(
+                    &quot;Ignoring LDAP record data with no UID attribute &quot;
+                    &quot;{source._uidField!r}: {recordData!r}&quot;,
+                    self=self, recordData=recordData
+                )
+                continue
+
+
+            # Coerce data to the correct type
+
+            for fieldName, value in fields.iteritems():
+                valueType = self.fieldName.valueType(fieldName)
+
+                if fieldName is recordTypeField:
+                    value = self._objectClassToRecordTypeMap[value]
+                elif valueType in (unicode, UUID):
+                    value = valueType(value)
+                else:
+                    raise LDAPConfigurationError(
+                        &quot;Unknown value type {0} for field {1}&quot;.format(
+                            valueType, fieldName
+                        )
+                    )
+
+                fields[fieldName] = value
+
+            # Make a record object from fields.
+
+            record = DirectoryRecord(self, fields)
+            records.append(record)
+
+        self.log.debug(&quot;LDAP results: {records}&quot;, records=records)
+
</ins><span class="cx">         returnValue(records)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx">     def recordsFromNonCompoundExpression(self, expression, records=None):
</span><span class="cx">         if isinstance(expression, MatchExpression):
</span><span class="cx">             queryString = ldapQueryStringFromMatchExpression(
</span><del>-                expression, self._fieldNameMap, self._recordTypeMap
</del><ins>+                expression,
+                self._fieldNameToAttributeMap, self._recordTypeToObjectClassMap
</ins><span class="cx">             )
</span><span class="cx">             return self._recordsFromQueryString(queryString)
</span><span class="cx"> 
</span><span class="lines">@@ -271,7 +383,8 @@
</span><span class="cx">             return ()
</span><span class="cx"> 
</span><span class="cx">         queryString = ldapQueryStringFromCompoundExpression(
</span><del>-            expression, self._fieldNameMap, self._recordTypeMap
</del><ins>+            expression,
+            self._fieldNameToAttributeMap, self._recordTypeToObjectClassMap
</ins><span class="cx">         )
</span><span class="cx">         return self._recordsFromQueryString(queryString)
</span><span class="cx"> 
</span></span></pre></div>
<a id="twexttrunktwextwholdaptesttest_servicepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/who/ldap/test/test_service.py (12336 => 12337)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/who/ldap/test/test_service.py        2014-01-14 20:29:48 UTC (rev 12336)
+++ twext/trunk/twext/who/ldap/test/test_service.py        2014-01-14 20:30:17 UTC (rev 12337)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">     &quot;&quot;&quot;
</span><span class="cx"> 
</span><span class="cx">     url = &quot;ldap://localhost/&quot;
</span><del>-    baseDN = u&quot;o=org&quot;
</del><ins>+    baseDN = u&quot;ou=calendarserver,o=org&quot;
</ins><span class="cx">     realmName = unicode(url)
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="lines">@@ -84,22 +84,6 @@
</span><span class="cx"> class DirectoryServiceConvenienceTestMixIn(
</span><span class="cx">     BaseDirectoryServiceConvenienceTestMixIn
</span><span class="cx"> ):
</span><del>-    def test_recordWithUID(self):
-        return (
-            BaseDirectoryServiceConvenienceTestMixIn.test_recordWithUID(self)
-        )
-
-    test_recordWithUID.todo = &quot;needs a seed?&quot;
-
-
-    def test_recordWithGUID(self):
-        return (
-            BaseDirectoryServiceConvenienceTestMixIn.test_recordWithGUID(self)
-        )
-
-    test_recordWithGUID.todo = &quot;needs a seed?&quot;
-
-
</del><span class="cx">     def test_recordsWithRecordType(self):
</span><span class="cx">         return (
</span><span class="cx">             BaseDirectoryServiceConvenienceTestMixIn
</span><span class="lines">@@ -109,25 +93,7 @@
</span><span class="cx">     test_recordsWithRecordType.todo = &quot;needs a seed?&quot;
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-    def test_recordWithShortName(self):
-        return (
-            BaseDirectoryServiceConvenienceTestMixIn
-            .test_recordWithShortName(self)
-        )
</del><span class="cx"> 
</span><del>-    test_recordWithShortName.todo = &quot;needs a seed?&quot;
-
-
-    def test_recordsWithEmailAddress(self):
-        return (
-            BaseDirectoryServiceConvenienceTestMixIn
-            .test_recordsWithEmailAddress(self)
-        )
-
-    test_recordsWithEmailAddress.todo = &quot;needs a seed?&quot;
-
-
-
</del><span class="cx"> class DirectoryServiceConnectionTestMixIn(object):
</span><span class="cx">     @inlineCallbacks
</span><span class="cx">     def test_connect_defaults(self):
</span><span class="lines">@@ -155,7 +121,7 @@
</span><span class="cx">         Connect with UsernamePassword credentials.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         credentials = UsernamePassword(
</span><del>-            u&quot;uid=wsanchez,cn=user,dc=calendarserver,dc=org&quot;,
</del><ins>+            u&quot;uid=wsanchez,cn=user,ou=calendarserver,o=org&quot;,
</ins><span class="cx">             u&quot;__password__&quot;
</span><span class="cx">         )
</span><span class="cx">         service = self.service(credentials=credentials)
</span><span class="lines">@@ -168,7 +134,7 @@
</span><span class="cx">         Connect with UsernamePassword credentials.
</span><span class="cx">         &quot;&quot;&quot;
</span><span class="cx">         credentials = UsernamePassword(
</span><del>-            u&quot;uid=wsanchez,cn=user,dc=calendarserver,dc=org&quot;,
</del><ins>+            u&quot;uid=wsanchez,cn=user,ou=calendarserver,o=org&quot;,
</ins><span class="cx">             u&quot;zehcnasw&quot;
</span><span class="cx">         )
</span><span class="cx">         service = self.service(credentials=credentials)
</span><span class="lines">@@ -249,7 +215,7 @@
</span><span class="cx"> 
</span><span class="cx">     data = {
</span><span class="cx">         u&quot;o={o}&quot;.format(o=o): dict(o=o),
</span><del>-        u&quot;ou={ou}&quot;.format(ou=ou): dict(ou=ou),
</del><ins>+        u&quot;ou={ou},o={o}&quot;.format(ou=ou, o=o): dict(ou=ou),
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     def toUnicode(obj):
</span><span class="lines">@@ -273,7 +239,7 @@
</span><span class="cx"> 
</span><span class="cx">     for records in service.index[service.fieldName.uid].itervalues():
</span><span class="cx">         for record in records:
</span><del>-            dn = u&quot;uid={uid},cn={cn},dc={ou},dc={o}&quot;.format(
</del><ins>+            dn = u&quot;uid={uid},cn={cn},ou={ou},o={o}&quot;.format(
</ins><span class="cx">                 uid=record.shortNames[0], cn=record.recordType.name, ou=ou, o=o
</span><span class="cx">             )
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>