<!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>[13077] CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_opendirectory.py</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/13077">13077</a></dd>
<dt>Author</dt> <dd>wsanchez@apple.com</dd>
<dt>Date</dt> <dd>2014-03-31 18:23:40 -0700 (Mon, 31 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Obsolete; tested module was removed.</pre>

<h3>Removed Paths</h3>
<ul>
<li><a href="#CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytesttest_opendirectorypy">CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_opendirectory.py</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServerbranchesuserssagenmove2who4twistedcaldavdirectorytesttest_opendirectorypy"></a>
<div class="delfile"><h4>Deleted: CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_opendirectory.py (13076 => 13077)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_opendirectory.py        2014-04-01 01:19:58 UTC (rev 13076)
+++ CalendarServer/branches/users/sagen/move2who-4/twistedcaldav/directory/test/test_opendirectory.py        2014-04-01 01:23:40 UTC (rev 13077)
</span><span class="lines">@@ -1,498 +0,0 @@
</span><del>-##
-# Copyright (c) 2005-2014 Apple Inc. All rights reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-##
-
-try:
-    from twistedcaldav.directory.appleopendirectory import OpenDirectoryService
-except ImportError:
-    pass
-else:
-    from calendarserver.platform.darwin.od import dsattributes
-    from collections import defaultdict
-    from txweb2.auth.digest import DigestedCredentials
-    from twisted.internet.defer import inlineCallbacks
-    from twisted.python.runtime import platform
-    from twisted.trial.unittest import SkipTest
-    from twistedcaldav.directory import augment
-    from twistedcaldav.directory.appleopendirectory import OpenDirectoryRecord
-    from twistedcaldav.directory.directory import DirectoryService
-    from txdav.common.datastore.test.util import deriveValue, withSpecialValue
-    import twistedcaldav.directory.test.util
-
-    class DigestAuthModule(object):
-        &quot;&quot;&quot;
-        Stand-in for either configurable OD module, that verifies the response
-        according to its '.response' attribute, set by the test.
-        &quot;&quot;&quot;
-        class ODError(Exception):
-            pass
-
-        def odInit(self, node):
-            return self
-
-        def authenticateUserDigest(self, directory, node, user, challenge,
-                                   response, method):
-            val = (response == self.response)
-            return val
-
-
-    # Wonky hack to prevent unclean reactor shutdowns
-    class DummyReactor(object):
-        @staticmethod
-        def callLater(*args):
-            pass
-
-    twistedcaldav.directory.appleopendirectory.reactor = DummyReactor
-
-    class OpenDirectory (
-        twistedcaldav.directory.test.util.BasicTestCase,
-        twistedcaldav.directory.test.util.DigestTestCase
-    ):
-        &quot;&quot;&quot;
-        Test Open Directory directory implementation.
-        &quot;&quot;&quot;
-        if not platform.isMacOSX():
-            skip = &quot;Currently, OpenDirectory backend only works on MacOS X.&quot;
-        recordTypes = set((
-            DirectoryService.recordType_users,
-            DirectoryService.recordType_groups,
-        ))
-
-        users = groups = {}
-
-        def setUp(self):
-            super(OpenDirectory, self).setUp()
-            try:
-                self._service = OpenDirectoryService(
-                    {
-                        &quot;node&quot; : &quot;/Search&quot;,
-                        &quot;augmentService&quot;: augment.AugmentXMLDB(xmlFiles=()),
-                    },
-                    odModule=deriveValue(self, &quot;odModule&quot;, lambda self: None)
-                )
-            except ImportError, e:
-                raise SkipTest(&quot;OpenDirectory module is not available: %s&quot; % (e,))
-
-        def service(self):
-            return self._service
-
-        def test_fullNameNone(self):
-            record = OpenDirectoryRecord(
-                service=self.service(),
-                recordType=DirectoryService.recordType_users,
-                guid=&quot;B1F93EB1-DA93-4772-9141-81C250DA36C2&quot;,
-                nodeName=&quot;/LDAPv2/127.0.0.1&quot;,
-                shortNames=(&quot;user&quot;,),
-                authIDs=set(),
-                fullName=None,
-                firstName=&quot;Some&quot;,
-                lastName=&quot;User&quot;,
-                emailAddresses=set((&quot;someuser@example.com&quot;,)),
-                memberGUIDs=[],
-                nestedGUIDs=[],
-                extProxies=[],
-                extReadOnlyProxies=[],
-            )
-            self.assertEquals(record.fullName, &quot;&quot;)
-
-
-        @withSpecialValue(&quot;odModule&quot;, DigestAuthModule())
-        def test_invalidODDigest(self):
-            record = OpenDirectoryRecord(
-                service=self.service(),
-                recordType=DirectoryService.recordType_users,
-                guid=&quot;B1F93EB1-DA93-4772-9141-81C250DA35B3&quot;,
-                nodeName=&quot;/LDAPv2/127.0.0.1&quot;,
-                shortNames=(&quot;user&quot;,),
-                authIDs=set(),
-                fullName=&quot;Some user&quot;,
-                firstName=&quot;Some&quot;,
-                lastName=&quot;User&quot;,
-                emailAddresses=set((&quot;someuser@example.com&quot;,)),
-                memberGUIDs=[],
-                nestedGUIDs=[],
-                extProxies=[],
-                extReadOnlyProxies=[],
-            )
-
-            digestFields = defaultdict(lambda: &quot;...&quot;)
-            digested = DigestedCredentials(&quot;user&quot;, &quot;GET&quot;, &quot;example.com&quot;,
-                                           digestFields)
-            od = deriveValue(self, &quot;odModule&quot;, lambda x: None)
-            od.response = &quot;invalid&quot;
-
-            self.assertFalse(record.verifyCredentials(digested))
-
-
-        @withSpecialValue(&quot;odModule&quot;, DigestAuthModule())
-        def test_validODDigest(self):
-            record = OpenDirectoryRecord(
-                service=self.service(),
-                recordType=DirectoryService.recordType_users,
-                guid=&quot;B1F93EB1-DA93-4772-9141-81C250DA35B3&quot;,
-                nodeName=&quot;/LDAPv2/127.0.0.1&quot;,
-                shortNames=(&quot;user&quot;,),
-                authIDs=set(),
-                fullName=&quot;Some user&quot;,
-                firstName=&quot;Some&quot;,
-                lastName=&quot;User&quot;,
-                emailAddresses=set((&quot;someuser@example.com&quot;,)),
-                memberGUIDs=[],
-                nestedGUIDs=[],
-                extProxies=[],
-                extReadOnlyProxies=[],
-            )
-
-            digestFields = {
-                &quot;username&quot;: &quot;user&quot;,
-                &quot;realm&quot;: &quot;/Search&quot;,
-                &quot;nonce&quot;: &quot;ABC&quot;,
-                &quot;uri&quot;: &quot;/&quot;,
-                &quot;response&quot;: &quot;123&quot;,
-                &quot;algorithm&quot;: &quot;md5&quot;,
-            }
-            od = deriveValue(self, &quot;odModule&quot;, lambda self: None)
-            od.response = (
-                'Digest username=&quot;%(username)s&quot;, '
-                'realm=&quot;%(realm)s&quot;, '
-                'nonce=&quot;%(nonce)s&quot;, '
-                'uri=&quot;%(uri)s&quot;, '
-                'response=&quot;%(response)s&quot;,'
-                'algorithm=%(algorithm)s'
-            ) % digestFields
-
-            digested = DigestedCredentials(&quot;user&quot;, &quot;GET&quot;, &quot;example.com&quot;,
-                                           digestFields)
-
-            self.assertTrue(record.verifyCredentials(digested))
-
-            # This should be defaulted
-            del digestFields[&quot;algorithm&quot;]
-
-            self.assertTrue(record.verifyCredentials(digested))
-
-        def test_queryDirectorySingleGUID(self):
-            &quot;&quot;&quot; Test for lookup on existing and non-existing GUIDs &quot;&quot;&quot;
-
-            def lookupMethod(obj, attr, value, matchType, casei, recordTypes, attributes, count=0):
-
-                data = {
-                    &quot;dsRecTypeStandard:Users&quot; : [
-                        {
-                            dsattributes.kDS1AttrGeneratedUID : &quot;1234567890&quot;,
-                            dsattributes.kDSNAttrRecordName : [&quot;user1&quot;, &quot;User 1&quot;],
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                        },
-                    ],
-                    &quot;dsRecTypeStandard:Groups&quot; : [],
-                }
-                results = []
-                for recordType in recordTypes:
-                    for entry in data[recordType]:
-                        if entry[attr] == value:
-                            results.append((&quot;&quot;, entry))
-                return results
-
-            recordTypes = [DirectoryService.recordType_users, DirectoryService.recordType_groups]
-            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_GUID, &quot;1234567890&quot;, lookupMethod=lookupMethod)
-            self.assertTrue(self.service().recordWithGUID(&quot;1234567890&quot;))
-            self.assertFalse(self.service().recordWithGUID(&quot;987654321&quot;))
-
-
-        def test_queryDirectoryDuplicateGUIDs(self):
-            &quot;&quot;&quot; Test for lookup on duplicate GUIDs, ensuring they don't get
-                faulted in &quot;&quot;&quot;
-
-            def lookupMethod(obj, attr, value, matchType, casei, recordType, attributes, count=0):
-
-                data = [
-                    {
-                        dsattributes.kDS1AttrGeneratedUID : &quot;1234567890&quot;,
-                        dsattributes.kDSNAttrRecordName : [&quot;user1&quot;, &quot;User 1&quot;],
-                        dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                    },
-                    {
-                        dsattributes.kDS1AttrGeneratedUID : &quot;1234567890&quot;,
-                        dsattributes.kDSNAttrRecordName : [&quot;user2&quot;, &quot;User 2&quot;],
-                        dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                    },
-                ]
-                results = []
-                for entry in data:
-                    if entry[attr] == value:
-                        results.append((&quot;&quot;, entry))
-                return results
-
-            recordTypes = [DirectoryService.recordType_users, DirectoryService.recordType_groups]
-            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_GUID, &quot;1234567890&quot;, lookupMethod=lookupMethod)
-            self.assertFalse(self.service().recordWithGUID(&quot;1234567890&quot;))
-
-        def test_queryDirectoryLocalUsers(self):
-            &quot;&quot;&quot; Test for lookup on local users, ensuring they do get
-                faulted in &quot;&quot;&quot;
-
-            def lookupMethod(obj, attr, value, matchType, casei, recordTypes, attributes, count=0):
-                data = {
-                    &quot;dsRecTypeStandard:Users&quot; : [
-                        {
-                            dsattributes.kDS1AttrGeneratedUID : &quot;1234567890&quot;,
-                            dsattributes.kDSNAttrRecordName : [&quot;user1&quot;, &quot;User 1&quot;],
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/Local/Default&quot;,
-                        },
-                        {
-                            dsattributes.kDS1AttrGeneratedUID : &quot;987654321&quot;,
-                            dsattributes.kDSNAttrRecordName : [&quot;user2&quot;, &quot;User 2&quot;],
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                        },
-                    ],
-                    &quot;dsRecTypeStandard:Groups&quot; : [],
-                }
-                results = []
-                for recordType in recordTypes:
-                    for entry in data[recordType]:
-                        if entry[attr] == value:
-                            results.append((&quot;&quot;, entry))
-                return results
-
-            recordTypes = [DirectoryService.recordType_users, DirectoryService.recordType_groups]
-            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_GUID, &quot;1234567890&quot;, lookupMethod=lookupMethod)
-            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_GUID, &quot;987654321&quot;, lookupMethod=lookupMethod)
-            self.assertTrue(self.service().recordWithGUID(&quot;1234567890&quot;))
-            self.assertTrue(self.service().recordWithGUID(&quot;987654321&quot;))
-
-        def test_queryDirectoryEmailAddresses(self):
-            &quot;&quot;&quot; Test to ensure we only ask for users when email address is
-                part of the query &quot;&quot;&quot;
-
-            def lookupMethod(obj, attr, value, matchType, casei, recordType, attributes, count=0):
-
-                if recordType != ['dsRecTypeStandard:Users']:
-                    raise ValueError
-
-                return []
-
-            recordTypes = [DirectoryService.recordType_users, DirectoryService.recordType_groups]
-            self.service().queryDirectory(recordTypes, self.service().INDEX_TYPE_CUA, &quot;mailto:user1@example.com&quot;, lookupMethod=lookupMethod)
-
-
-        @inlineCallbacks
-        def test_recordsMatchingFields(self):
-
-
-            def lookupMethod(obj, attribute, value, matchType, caseless,
-                recordTypes, attributes):
-
-                data = {
-                    dsattributes.kDSStdRecordTypeUsers : (
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Morgen Sagen&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;morgen&quot;,
-                            dsattributes.kDS1AttrFirstName : &quot;Morgen&quot;,
-                            dsattributes.kDS1AttrLastName : &quot;Sagen&quot;,
-                            dsattributes.kDSNAttrEMailAddress : &quot;morgen@example.com&quot;,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;83479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                        },
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Morgan Sagan&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;morgan&quot;,
-                            dsattributes.kDS1AttrFirstName : &quot;Morgan&quot;,
-                            dsattributes.kDS1AttrLastName : &quot;Sagan&quot;,
-                            dsattributes.kDSNAttrEMailAddress : &quot;morgan@example.com&quot;,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;93479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                        },
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Shari Sagen&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;shari&quot;,
-                            dsattributes.kDS1AttrFirstName : &quot;Shari&quot;,
-                            dsattributes.kDS1AttrLastName : &quot;Sagen&quot;,
-                            dsattributes.kDSNAttrEMailAddress : &quot;shari@example.com&quot;,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;A3479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                        },
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Local Morgen&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;localmorgen&quot;,
-                            dsattributes.kDS1AttrFirstName : &quot;Local&quot;,
-                            dsattributes.kDS1AttrLastName : &quot;Morgen&quot;,
-                            dsattributes.kDSNAttrEMailAddress : &quot;localmorgen@example.com&quot;,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/Local/Default&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;B3479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeUsers,
-                        },
-                    ),
-                    dsattributes.kDSStdRecordTypeGroups : (
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Test Group&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;testgroup&quot;,
-                            dsattributes.kDS1AttrFirstName : None,
-                            dsattributes.kDS1AttrLastName : None,
-                            dsattributes.kDSNAttrEMailAddress : None,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;C3479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeGroups,
-                        },
-                        {
-                            dsattributes.kDS1AttrDistinguishedName : &quot;Morgen's Group&quot;,
-                            dsattributes.kDSNAttrRecordName : &quot;morgensgroup&quot;,
-                            dsattributes.kDS1AttrFirstName : None,
-                            dsattributes.kDS1AttrLastName : None,
-                            dsattributes.kDSNAttrEMailAddress : None,
-                            dsattributes.kDSNAttrMetaNodeLocation : &quot;/LDAPv3/127.0.0.1&quot;,
-                            dsattributes.kDS1AttrGeneratedUID : &quot;D3479230-821E-11DE-B6B0-DBB02C6D659D&quot;,
-                            dsattributes.kDSNAttrRecordType : dsattributes.kDSStdRecordTypeGroups,
-                        },
-                    ),
-                    dsattributes.kDSStdRecordTypePlaces : (),
-                    dsattributes.kDSStdRecordTypeResources : (),
-                }
-
-                def attributeMatches(fieldValue, value, caseless, matchType):
-                    if fieldValue is None:
-                        return False
-                    if caseless:
-                        fieldValue = fieldValue.lower()
-                        value = value.lower()
-                    if matchType == dsattributes.eDSStartsWith:
-                        if fieldValue.startswith(value):
-                            return True
-                    elif matchType == dsattributes.eDSContains:
-                        try:
-                            fieldValue.index(value)
-                            return True
-                        except ValueError:
-                            pass
-                    else: # exact
-                        if fieldValue == value:
-                            return True
-                    return False
-
-                results = []
-                for recordType in recordTypes:
-                    for row in data[recordType]:
-                        if attributeMatches(row[attribute], value, caseless,
-                            matchType):
-                            results.append((row[dsattributes.kDSNAttrRecordName], row))
-
-                return results
-
-            #
-            # OR
-            #
-            fields = [
-                (&quot;fullName&quot;, &quot;mor&quot;, True, u&quot;starts-with&quot;),
-                (&quot;emailAddresses&quot;, &quot;mor&quot;, True, u&quot;starts-with&quot;),
-                (&quot;firstName&quot;, &quot;mor&quot;, True, u&quot;starts-with&quot;),
-                (&quot;lastName&quot;, &quot;mor&quot;, True, u&quot;starts-with&quot;),
-            ]
-
-            # any record type
-            results = (yield self.service().recordsMatchingFields(
-                fields,
-                lookupMethod=lookupMethod
-            ))
-            results = list(results)
-            self.assertEquals(len(results), 4)
-            for record in results:
-                self.assertTrue(isinstance(record, OpenDirectoryRecord))
-
-            # just users
-            results = (yield self.service().recordsMatchingFields(fields,
-                recordType=&quot;users&quot;,
-                lookupMethod=lookupMethod))
-            results = list(results)
-            self.assertEquals(len(results), 3)
-
-            # just groups
-            results = (yield self.service().recordsMatchingFields(fields,
-                recordType=&quot;groups&quot;,
-                lookupMethod=lookupMethod))
-            results = list(results)
-            self.assertEquals(len(results), 1)
-
-            #
-            # AND
-            #
-            fields = [
-                (&quot;firstName&quot;, &quot;morgen&quot;, True, u&quot;equals&quot;),
-                (&quot;lastName&quot;, &quot;age&quot;, True, u&quot;contains&quot;)
-            ]
-            results = (yield self.service().recordsMatchingFields(fields,
-                operand=&quot;and&quot;, lookupMethod=lookupMethod))
-            results = list(results)
-            self.assertEquals(len(results), 1)
-
-            #
-            # case sensitivity
-            #
-            fields = [
-                (&quot;firstName&quot;, &quot;morgen&quot;, False, u&quot;equals&quot;),
-            ]
-            results = (yield self.service().recordsMatchingFields(fields,
-                lookupMethod=lookupMethod))
-            results = list(results)
-            self.assertEquals(len(results), 0)
-
-            fields = [
-                (&quot;firstName&quot;, &quot;morgen&quot;, True, u&quot;equals&quot;),
-            ]
-            results = (yield self.service().recordsMatchingFields(
-                fields,
-                lookupMethod=lookupMethod
-            ))
-            results = list(results)
-            self.assertEquals(len(results), 1)
-
-            #
-            # no matches
-            #
-            fields = [
-                (&quot;firstName&quot;, &quot;xyzzy&quot;, True, u&quot;starts-with&quot;),
-                (&quot;lastName&quot;, &quot;plugh&quot;, True, u&quot;contains&quot;)
-            ]
-            results = (yield self.service().recordsMatchingFields(
-                fields,
-                operand=&quot;and&quot;,
-                lookupMethod=lookupMethod
-            ))
-            results = list(results)
-            self.assertEquals(len(results), 0)
-
-
-    class OpenDirectorySubset (OpenDirectory):
-        &quot;&quot;&quot;
-        Test the recordTypes subset feature of Apple OpenDirectoryService.
-        &quot;&quot;&quot;
-        recordTypes = set((
-            DirectoryService.recordType_users,
-            DirectoryService.recordType_groups,
-        ))
-
-        def setUp(self):
-            super(OpenDirectorySubset, self).setUp()
-            self._service = OpenDirectoryService(
-                {
-                    &quot;node&quot; : &quot;/Search&quot;,
-                    &quot;recordTypes&quot; : (DirectoryService.recordType_users, DirectoryService.recordType_groups),
-                    &quot;augmentService&quot; : augment.AugmentXMLDB(xmlFiles=()),
-                },
-                odModule=deriveValue(self, &quot;odModule&quot;, lambda x: None)
-            )
</del></span></pre>
</div>
</div>

</body>
</html>