<!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>[12255] CalendarServer/trunk/twistedcaldav/directory/test/test_ldapdirectory.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/12255">12255</a></dd>
<dt>Author</dt> <dd>sagen@apple.com</dd>
<dt>Date</dt> <dd>2014-01-07 10:34:58 -0800 (Tue, 07 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>lint cleanup</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#CalendarServertrunktwistedcaldavdirectorytesttest_ldapdirectorypy">CalendarServer/trunk/twistedcaldav/directory/test/test_ldapdirectory.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="CalendarServertrunktwistedcaldavdirectorytesttest_ldapdirectorypy"></a>
<div class="modfile"><h4>Modified: CalendarServer/trunk/twistedcaldav/directory/test/test_ldapdirectory.py (12254 => 12255)</h4>
<pre class="diff"><span>
<span class="info">--- CalendarServer/trunk/twistedcaldav/directory/test/test_ldapdirectory.py        2014-01-07 03:49:51 UTC (rev 12254)
+++ CalendarServer/trunk/twistedcaldav/directory/test/test_ldapdirectory.py        2014-01-07 18:34:58 UTC (rev 12255)
</span><span class="lines">@@ -23,9 +23,13 @@
</span><span class="cx"> )
</span><span class="cx"> from twistedcaldav.directory.util import splitIntoBatches
</span><span class="cx"> from twistedcaldav.test.util import proxiesFile
</span><del>- from twistedcaldav.directory.calendaruserproxyloader import XMLCalendarUserProxyLoader
</del><ins>+ from twistedcaldav.directory.calendaruserproxyloader import (
+ XMLCalendarUserProxyLoader
+ )
</ins><span class="cx"> from twistedcaldav.directory import calendaruserproxy
</span><del>- from twistedcaldav.directory.directory import GroupMembershipCache, GroupMembershipCacheUpdater
</del><ins>+ from twistedcaldav.directory.directory import (
+ GroupMembershipCache, GroupMembershipCacheUpdater
+ )
</ins><span class="cx"> from twisted.internet.defer import inlineCallbacks
</span><span class="cx"> from string import maketrans
</span><span class="cx"> import ldap
</span><span class="lines">@@ -38,79 +42,79 @@
</span><span class="cx">
</span><span class="cx"> def test_buildFilter(self):
</span><span class="cx"> mapping = {
</span><del>- "recordName" : "uid",
- "fullName" : "cn",
- "emailAddresses" : "mail",
- "firstName" : "givenName",
- "lastName" : "sn",
- "guid" : "generateduid",
- "memberIDAttr" : "generateduid",
</del><ins>+ "recordName": "uid",
+ "fullName": "cn",
+ "emailAddresses": "mail",
+ "firstName": "givenName",
+ "lastName": "sn",
+ "guid": "generateduid",
+ "memberIDAttr": "generateduid",
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> entries = [
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"starts-with"),
</span><span class="cx"> ("emailAddresses", "mor", True, u"starts-with"),
</span><span class="cx"> ("firstName", "mor", True, u"starts-with"),
</span><span class="cx"> ("lastName", "mor", True, u"starts-with")
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "users",
- "expected" : "(&(uid=*)(generateduid=*)(|(cn=mor*)(mail=mor*)(givenName=mor*)(sn=mor*)))",
- "optimize" : False,
</del><ins>+ "operand": "or",
+ "recordType": "users",
+ "expected": "(&(uid=*)(generateduid=*)(|(cn=mor*)(mail=mor*)(givenName=mor*)(sn=mor*)))",
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor(", True, u"starts-with"),
</span><span class="cx"> ("emailAddresses", "mor)", True, u"contains"),
</span><span class="cx"> ("firstName", "mor*", True, u"exact"),
</span><span class="cx"> ("lastName", "mor\\", True, u"starts-with")
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "users",
- "expected" : "(&(uid=*)(generateduid=*)(|(cn=mor\\28*)(mail=*mor\\29*)(givenName=mor\\2a)(sn=mor\\5c*)))",
- "optimize" : False,
</del><ins>+ "operand": "or",
+ "recordType": "users",
+ "expected": "(&(uid=*)(generateduid=*)(|(cn=mor\\28*)(mail=*mor\\29*)(givenName=mor\\2a)(sn=mor\\5c*)))",
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "users",
- "expected" : "(&(uid=*)(generateduid=*)(cn=mor*))",
- "optimize" : False,
</del><ins>+ "operand": "or",
+ "recordType": "users",
+ "expected": "(&(uid=*)(generateduid=*)(cn=mor*))",
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"contains"),
</span><span class="cx"> ("emailAddresses", "mor", True, u"equals"),
</span><span class="cx"> ("invalid", "mor", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "and",
- "recordType" : "users",
- "expected" : "(&(uid=*)(generateduid=*)(&(cn=*mor*)(mail=mor)))",
- "optimize" : False,
</del><ins>+ "operand": "and",
+ "recordType": "users",
+ "expected": "(&(uid=*)(generateduid=*)(&(cn=*mor*)(mail=mor)))",
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("invalid", "mor", True, u"contains"),
</span><span class="cx"> ("invalid", "mor", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "and",
- "recordType" : "users",
- "expected" : None,
- "optimize" : False,
</del><ins>+ "operand": "and",
+ "recordType": "users",
+ "expected": None,
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [ ],
- "operand" : "and",
- "recordType" : "users",
- "expected" : None,
- "optimize" : False,
</del><ins>+ "fields": [],
+ "operand": "and",
+ "recordType": "users",
+ "expected": None,
+ "optimize": False,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"starts-with"),
</span><span class="cx"> ("fullName", "sag", True, u"starts-with"),
</span><span class="cx"> ("emailAddresses", "mor", True, u"starts-with"),
</span><span class="lines">@@ -120,13 +124,13 @@
</span><span class="cx"> ("lastName", "mor", True, u"starts-with"),
</span><span class="cx"> ("lastName", "sag", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "users",
- "expected" : "(&(uid=*)(generateduid=*)(|(&(givenName=mor*)(sn=sag*))(&(givenName=sag*)(sn=mor*))))",
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "users",
+ "expected": "(&(uid=*)(generateduid=*)(|(&(givenName=mor*)(sn=sag*))(&(givenName=sag*)(sn=mor*))))",
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"starts-with"),
</span><span class="cx"> ("fullName", "sag", True, u"starts-with"),
</span><span class="cx"> ("emailAddresses", "mor", True, u"starts-with"),
</span><span class="lines">@@ -136,13 +140,13 @@
</span><span class="cx"> ("lastName", "mor", True, u"starts-with"),
</span><span class="cx"> ("lastName", "sag", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "groups",
- "expected" : None,
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "groups",
+ "expected": None,
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"starts-with"),
</span><span class="cx"> ("fullName", "sag", True, u"starts-with"),
</span><span class="cx"> ("emailAddresses", "mor", True, u"starts-with"),
</span><span class="lines">@@ -152,140 +156,141 @@
</span><span class="cx"> ("lastName", "mor", True, u"starts-with"),
</span><span class="cx"> ("lastName", "sag", True, u"starts-with"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "groups",
- "expected" : None,
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "groups",
+ "expected": None,
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("guid", "xyzzy", True, u"equals"),
</span><span class="cx"> ("guid", "plugh", True, u"equals"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "groups",
- "expected" : "(&(uid=*)(generateduid=*)(|(generateduid=xyzzy)(generateduid=plugh)))",
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "groups",
+ "expected": "(&(uid=*)(generateduid=*)(|(generateduid=xyzzy)(generateduid=plugh)))",
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"contains"),
</span><span class="cx"> ("fullName", "sag", True, u"contains"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "locations",
- "expected" : "(&(uid=*)(generateduid=*)(|(cn=*mor*)(cn=*sag*)))",
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "locations",
+ "expected": "(&(uid=*)(generateduid=*)(|(cn=*mor*)(cn=*sag*)))",
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "fields" : [
</del><ins>+ "fields": [
</ins><span class="cx"> ("fullName", "mor", True, u"contains"),
</span><span class="cx"> ("fullName", "sag", True, u"contains"),
</span><span class="cx"> ],
</span><del>- "operand" : "or",
- "recordType" : "resources",
- "expected" : "(&(uid=*)(generateduid=*)(|(cn=*mor*)(cn=*sag*)))",
- "optimize" : True,
</del><ins>+ "operand": "or",
+ "recordType": "resources",
+ "expected": "(&(uid=*)(generateduid=*)(|(cn=*mor*)(cn=*sag*)))",
+ "optimize": True,
</ins><span class="cx"> },
</span><span class="cx"> ]
</span><span class="cx"> for entry in entries:
</span><span class="cx"> self.assertEquals(
</span><span class="cx"> buildFilter(entry["recordType"], mapping, entry["fields"],
</span><del>- operand=entry["operand"], optimizeMultiName=entry["optimize"]),
</del><ins>+ operand=entry["operand"], optimizeMultiName=entry["optimize"]),
</ins><span class="cx"> entry["expected"]
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> class BuildFilterFromTokensTestCase(TestCase):
</span><span class="cx">
</span><span class="cx"> def test_buildFilterFromTokens(self):
</span><span class="cx">
</span><span class="cx"> entries = [
</span><span class="cx"> {
</span><del>- "tokens" : ["foo"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ "tokens": ["foo"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(a=b)(|(cn=*foo*)(mail=foo*)))",
- "extra" : "(a=b)",
</del><ins>+ "expected": "(&(a=b)(|(cn=*foo*)(mail=foo*)))",
+ "extra": "(a=b)",
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "foo", "oo", "fo", "bar"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ "tokens": ["foo", "foo", "oo", "fo", "bar"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(a=b)(|(cn=*bar*)(mail=bar*))(|(cn=*foo*)(mail=foo*)))",
- "extra" : "(a=b)",
</del><ins>+ "expected": "(&(a=b)(|(cn=*bar*)(mail=bar*))(|(cn=*foo*)(mail=foo*)))",
+ "extra": "(a=b)",
</ins><span class="cx"> },
</span><del>- {
- "tokens" : ["fo", "foo", "foooo", "ooo", "fooo"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ {
+ "tokens": ["fo", "foo", "foooo", "ooo", "fooo"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(a=b)(|(cn=*foooo*)(mail=foooo*)))",
- "extra" : "(a=b)",
</del><ins>+ "expected": "(&(a=b)(|(cn=*foooo*)(mail=foooo*)))",
+ "extra": "(a=b)",
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : ["mail", "mailAliases"],
</del><ins>+ "tokens": ["foo"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": ["mail", "mailAliases"],
</ins><span class="cx"> },
</span><del>- "expected" : "(&(a=b)(|(cn=*foo*)(mail=foo*)(mailAliases=foo*)))",
- "extra" : "(a=b)",
</del><ins>+ "expected": "(&(a=b)(|(cn=*foo*)(mail=foo*)(mailAliases=foo*)))",
+ "extra": "(a=b)",
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : [],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ "tokens": [],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : None,
- "extra" : None,
</del><ins>+ "expected": None,
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "bar"],
- "mapping" : { },
- "expected" : None,
- "extra" : None,
</del><ins>+ "tokens": ["foo", "bar"],
+ "mapping": {},
+ "expected": None,
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "bar"],
- "mapping" : {
- "emailAddresses" : "mail",
</del><ins>+ "tokens": ["foo", "bar"],
+ "mapping": {
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(mail=bar*)(mail=foo*))",
- "extra" : None,
</del><ins>+ "expected": "(&(mail=bar*)(mail=foo*))",
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "bar"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ "tokens": ["foo", "bar"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(|(cn=*bar*)(mail=bar*))(|(cn=*foo*)(mail=foo*)))",
- "extra" : None,
</del><ins>+ "expected": "(&(|(cn=*bar*)(mail=bar*))(|(cn=*foo*)(mail=foo*)))",
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "bar"],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : ["mail", "mailAliases"],
</del><ins>+ "tokens": ["foo", "bar"],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": ["mail", "mailAliases"],
</ins><span class="cx"> },
</span><del>- "expected" : "(&(|(cn=*bar*)(mail=bar*)(mailAliases=bar*))(|(cn=*foo*)(mail=foo*)(mailAliases=foo*)))",
- "extra" : None,
</del><ins>+ "expected": "(&(|(cn=*bar*)(mail=bar*)(mailAliases=bar*))(|(cn=*foo*)(mail=foo*)(mailAliases=foo*)))",
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> {
</span><del>- "tokens" : ["foo", "bar", "baz("],
- "mapping" : {
- "fullName" : "cn",
- "emailAddresses" : "mail",
</del><ins>+ "tokens": ["foo", "bar", "baz("],
+ "mapping": {
+ "fullName": "cn",
+ "emailAddresses": "mail",
</ins><span class="cx"> },
</span><del>- "expected" : "(&(|(cn=*bar*)(mail=bar*))(|(cn=*baz\\28*)(mail=baz\\28*))(|(cn=*foo*)(mail=foo*)))",
- "extra" : None,
</del><ins>+ "expected": "(&(|(cn=*bar*)(mail=bar*))(|(cn=*baz\\28*)(mail=baz\\28*))(|(cn=*foo*)(mail=foo*)))",
+ "extra": None,
</ins><span class="cx"> },
</span><span class="cx"> ]
</span><span class="cx"> for entry in entries:
</span><span class="lines">@@ -295,12 +300,13 @@
</span><span class="cx"> )
</span><span class="cx">
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> class StubList(object):
</span><span class="cx"> def __init__(self, wrapper):
</span><span class="cx"> self.ldap = wrapper
</span><span class="cx">
</span><span class="cx"> def startSearch(self, base, scope, filterstr, attrList=None,
</span><del>- timeout=-1, sizelimit=0):
</del><ins>+ timeout=-1, sizelimit=0):
</ins><span class="cx"> self.base = base
</span><span class="cx"> self.scope = scope
</span><span class="cx"> self.filterstr = filterstr
</span><span class="lines">@@ -310,14 +316,17 @@
</span><span class="cx">
</span><span class="cx"> def processResults(self):
</span><span class="cx"> self.allResults = self.ldap.search_s(self.base, self.scope,
</span><del>- self.filterstr, attrlist=self.attrList)
</del><ins>+ self.filterstr,
+ attrlist=self.attrList)
</ins><span class="cx">
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> class StubAsync(object):
</span><span class="cx"> def List(self, wrapper):
</span><span class="cx"> return StubList(wrapper)
</span><span class="cx">
</span><span class="cx">
</span><ins>+
</ins><span class="cx"> class LdapDirectoryTestWrapper(object):
</span><span class="cx"> """
</span><span class="cx"> A test stub which replaces search_s( ) with a version that will return
</span><span class="lines">@@ -335,7 +344,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> def search_s(self, base, scope, filterstr="(objectClass=*)",
</span><del>- attrlist=None):
</del><ins>+ attrlist=None):
</ins><span class="cx"> """ A simple implementation of LDAP search filter processing """
</span><span class="cx">
</span><span class="cx"> base = normalizeDNstr(base)
</span><span class="lines">@@ -493,8 +502,8 @@
</span><span class="cx"> 'givenName': ['Test'],
</span><span class="cx"> 'cn': ['Test Resource'],
</span><span class="cx"> # purposely throw in an un-normalized GUID
</span><del>- 'read-write-proxy' : ['6423f94a-6b76-4a3a-815b-d52cfd77935d'],
- 'read-only-proxy' : ['5A985493-EE2C-4665-94CF-4DFEA3A89500'],
</del><ins>+ 'read-write-proxy': ['6423f94a-6b76-4a3a-815b-d52cfd77935d'],
+ 'read-only-proxy': ['5A985493-EE2C-4665-94CF-4DFEA3A89500'],
</ins><span class="cx"> }
</span><span class="cx"> ),
</span><span class="cx"> (
</span><span class="lines">@@ -505,14 +514,14 @@
</span><span class="cx"> 'sn': ['Resource2'],
</span><span class="cx"> 'givenName': ['Test'],
</span><span class="cx"> 'cn': ['Test Resource2'],
</span><del>- 'read-write-proxy' : ['6423F94A-6B76-4A3A-815B-D52CFD77935D'],
</del><ins>+ 'read-write-proxy': ['6423F94A-6B76-4A3A-815B-D52CFD77935D'],
</ins><span class="cx"> }
</span><span class="cx"> ),
</span><span class="cx"> ),
</span><span class="cx"> {
</span><del>- "augmentService" : None,
- "groupMembershipCache" : None,
- "cacheTimeout": 1, # Minutes
</del><ins>+ "augmentService": None,
+ "groupMembershipCache": None,
+ "cacheTimeout": 1, # Minutes
</ins><span class="cx"> "negativeCaching": False,
</span><span class="cx"> "warningThresholdSeconds": 3,
</span><span class="cx"> "batchSize": 500,
</span><span class="lines">@@ -524,7 +533,7 @@
</span><span class="cx"> "tls": False,
</span><span class="cx"> "tlsCACertFile": None,
</span><span class="cx"> "tlsCACertDir": None,
</span><del>- "tlsRequireCert": None, # never, allow, try, demand, hard
</del><ins>+ "tlsRequireCert": None, # never, allow, try, demand, hard
</ins><span class="cx"> "credentials": {
</span><span class="cx"> "dn": None,
</span><span class="cx"> "password": None,
</span><span class="lines">@@ -535,83 +544,83 @@
</span><span class="cx"> "guidAttr": "apple-generateduid",
</span><span class="cx"> "users": {
</span><span class="cx"> "rdn": "cn=Users",
</span><del>- "attr": "uid", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "loginEnabledAttr" : "", # attribute controlling login
- "loginEnabledValue" : "yes", # "True" value of above attribute
- "calendarEnabledAttr" : "enable-calendar", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "uid", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "loginEnabledAttr": "", # attribute controlling login
+ "loginEnabledValue": "yes", # "True" value of above attribute
+ "calendarEnabledAttr": "enable-calendar", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "uid",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groups": {
</span><span class="cx"> "rdn": "cn=Groups",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "locations": {
</span><span class="cx"> "rdn": "cn=Places",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "associatedAddressAttr" : "assocAddr",
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "associatedAddressAttr": "assocAddr",
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : "", # old style, single string
</del><ins>+ "fullName": "cn",
+ "emailAddresses": "", # old style, single string
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "resources": {
</span><span class="cx"> "rdn": "cn=Resources",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : [], # new style, array
</del><ins>+ "fullName": "cn",
+ "emailAddresses": [], # new style, array
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "addresses": {
</span><span class="cx"> "rdn": "cn=Buildings",
</span><del>- "geoAttr" : "coordinates",
- "streetAddressAttr" : "postal",
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "geoAttr": "coordinates",
+ "streetAddressAttr": "postal",
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
</del><ins>+ "fullName": "cn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groupSchema": {
</span><del>- "membersAttr": "uniqueMember", # how members are specified
- "nestedGroupsAttr": "nestedGroups", # how nested groups are specified
- "memberIdAttr": "", # which attribute the above refer to
</del><ins>+ "membersAttr": "uniqueMember", # how members are specified
+ "nestedGroupsAttr": "nestedGroups", # how nested groups are specified
+ "memberIdAttr": "", # which attribute the above refer to
</ins><span class="cx"> },
</span><span class="cx"> "resourceSchema": {
</span><del>- "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</del><ins>+ "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</ins><span class="cx"> "autoScheduleAttr": None,
</span><span class="cx"> "proxyAttr": "read-write-proxy",
</span><span class="cx"> "readOnlyProxyAttr": "read-only-proxy",
</span><span class="cx"> "autoAcceptGroupAttr": None,
</span><span class="cx"> },
</span><span class="cx"> "poddingSchema": {
</span><del>- "serverIdAttr": "server-id", # maps to augments server-id
</del><ins>+ "serverIdAttr": "server-id", # maps to augments server-id
</ins><span class="cx"> },
</span><span class="cx"> }
</span><span class="cx"> )
</span><span class="lines">@@ -729,9 +738,9 @@
</span><span class="cx"> ),
</span><span class="cx"> ),
</span><span class="cx"> {
</span><del>- "augmentService" : None,
- "groupMembershipCache" : None,
- "cacheTimeout": 1, # Minutes
</del><ins>+ "augmentService": None,
+ "groupMembershipCache": None,
+ "cacheTimeout": 1, # Minutes
</ins><span class="cx"> "negativeCaching": False,
</span><span class="cx"> "warningThresholdSeconds": 3,
</span><span class="cx"> "batchSize": 500,
</span><span class="lines">@@ -743,7 +752,7 @@
</span><span class="cx"> "tls": False,
</span><span class="cx"> "tlsCACertFile": None,
</span><span class="cx"> "tlsCACertDir": None,
</span><del>- "tlsRequireCert": None, # never, allow, try, demand, hard
</del><ins>+ "tlsRequireCert": None, # never, allow, try, demand, hard
</ins><span class="cx"> "credentials": {
</span><span class="cx"> "dn": None,
</span><span class="cx"> "password": None,
</span><span class="lines">@@ -754,79 +763,79 @@
</span><span class="cx"> "guidAttr": "apple-generateduid",
</span><span class="cx"> "users": {
</span><span class="cx"> "rdn": "cn=Users",
</span><del>- "attr": "uid", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "loginEnabledAttr" : "", # attribute controlling login
- "loginEnabledValue" : "yes", # "True" value of above attribute
- "calendarEnabledAttr" : "enable-calendar", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "uid", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "loginEnabledAttr": "", # attribute controlling login
+ "loginEnabledValue": "yes", # "True" value of above attribute
+ "calendarEnabledAttr": "enable-calendar", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "uid",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groups": {
</span><span class="cx"> "rdn": "cn=Groups",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "locations": {
</span><span class="cx"> "rdn": "cn=Places",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : "", # old style, single string
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": "", # old style, single string
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "resources": {
</span><span class="cx"> "rdn": "cn=Resources",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : [], # new style, array
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": [], # new style, array
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groupSchema": {
</span><del>- "membersAttr": "uniqueMember", # how members are specified
- "nestedGroupsAttr": "", # how nested groups are specified
- "memberIdAttr": "", # which attribute the above refer to
</del><ins>+ "membersAttr": "uniqueMember", # how members are specified
+ "nestedGroupsAttr": "", # how nested groups are specified
+ "memberIdAttr": "", # which attribute the above refer to
</ins><span class="cx"> },
</span><span class="cx"> "resourceSchema": {
</span><del>- "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</del><ins>+ "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</ins><span class="cx"> "autoScheduleAttr": None,
</span><span class="cx"> "proxyAttr": None,
</span><span class="cx"> "readOnlyProxyAttr": None,
</span><span class="cx"> "autoAcceptGroupAttr": None,
</span><span class="cx"> },
</span><span class="cx"> "poddingSchema": {
</span><del>- "serverIdAttr": "server-id", # maps to augments server-id
</del><ins>+ "serverIdAttr": "server-id", # maps to augments server-id
</ins><span class="cx"> },
</span><span class="cx"> }
</span><span class="cx"> )
</span><span class="lines">@@ -946,9 +955,9 @@
</span><span class="cx"> ),
</span><span class="cx"> ),
</span><span class="cx"> {
</span><del>- "augmentService" : None,
- "groupMembershipCache" : None,
- "cacheTimeout": 1, # Minutes
</del><ins>+ "augmentService": None,
+ "groupMembershipCache": None,
+ "cacheTimeout": 1, # Minutes
</ins><span class="cx"> "negativeCaching": False,
</span><span class="cx"> "warningThresholdSeconds": 3,
</span><span class="cx"> "batchSize": 500,
</span><span class="lines">@@ -960,7 +969,7 @@
</span><span class="cx"> "tls": False,
</span><span class="cx"> "tlsCACertFile": None,
</span><span class="cx"> "tlsCACertDir": None,
</span><del>- "tlsRequireCert": None, # never, allow, try, demand, hard
</del><ins>+ "tlsRequireCert": None, # never, allow, try, demand, hard
</ins><span class="cx"> "credentials": {
</span><span class="cx"> "dn": None,
</span><span class="cx"> "password": None,
</span><span class="lines">@@ -971,79 +980,79 @@
</span><span class="cx"> "guidAttr": "apple-generateduid",
</span><span class="cx"> "users": {
</span><span class="cx"> "rdn": "cn=Users",
</span><del>- "attr": "uid", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "loginEnabledAttr" : "", # attribute controlling login
- "loginEnabledValue" : "yes", # "True" value of above attribute
- "calendarEnabledAttr" : "enable-calendar", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "uid", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "loginEnabledAttr": "", # attribute controlling login
+ "loginEnabledValue": "yes", # "True" value of above attribute
+ "calendarEnabledAttr": "enable-calendar", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "uid",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groups": {
</span><span class="cx"> "rdn": "cn=Groups",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "locations": {
</span><span class="cx"> "rdn": "cn=Places",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : "", # old style, single string
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": "", # old style, single string
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "resources": {
</span><span class="cx"> "rdn": "cn=Resources",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : [], # new style, array
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": [], # new style, array
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groupSchema": {
</span><del>- "membersAttr": "uniqueMember", # how members are specified
- "nestedGroupsAttr": "nestedGroups", # how nested groups are specified
- "memberIdAttr": "apple-generateduid", # which attribute the above refer to
</del><ins>+ "membersAttr": "uniqueMember", # how members are specified
+ "nestedGroupsAttr": "nestedGroups", # how nested groups are specified
+ "memberIdAttr": "apple-generateduid", # which attribute the above refer to
</ins><span class="cx"> },
</span><span class="cx"> "resourceSchema": {
</span><del>- "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</del><ins>+ "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</ins><span class="cx"> "autoScheduleAttr": None,
</span><span class="cx"> "proxyAttr": None,
</span><span class="cx"> "readOnlyProxyAttr": None,
</span><span class="cx"> "autoAcceptGroupAttr": None,
</span><span class="cx"> },
</span><span class="cx"> "poddingSchema": {
</span><del>- "serverIdAttr": "server-id", # maps to augments server-id
</del><ins>+ "serverIdAttr": "server-id", # maps to augments server-id
</ins><span class="cx"> },
</span><span class="cx"> }
</span><span class="cx"> )
</span><span class="lines">@@ -1159,9 +1168,9 @@
</span><span class="cx"> ),
</span><span class="cx"> ),
</span><span class="cx"> {
</span><del>- "augmentService" : None,
- "groupMembershipCache" : None,
- "cacheTimeout": 1, # Minutes
</del><ins>+ "augmentService": None,
+ "groupMembershipCache": None,
+ "cacheTimeout": 1, # Minutes
</ins><span class="cx"> "negativeCaching": False,
</span><span class="cx"> "warningThresholdSeconds": 3,
</span><span class="cx"> "batchSize": 500,
</span><span class="lines">@@ -1173,7 +1182,7 @@
</span><span class="cx"> "tls": False,
</span><span class="cx"> "tlsCACertFile": None,
</span><span class="cx"> "tlsCACertDir": None,
</span><del>- "tlsRequireCert": None, # never, allow, try, demand, hard
</del><ins>+ "tlsRequireCert": None, # never, allow, try, demand, hard
</ins><span class="cx"> "credentials": {
</span><span class="cx"> "dn": None,
</span><span class="cx"> "password": None,
</span><span class="lines">@@ -1184,79 +1193,79 @@
</span><span class="cx"> "guidAttr": "apple-generateduid",
</span><span class="cx"> "users": {
</span><span class="cx"> "rdn": "cn=Users",
</span><del>- "attr": "uid", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "loginEnabledAttr" : "", # attribute controlling login
- "loginEnabledValue" : "yes", # "True" value of above attribute
- "calendarEnabledAttr" : "enable-calendar", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "uid", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "loginEnabledAttr": "", # attribute controlling login
+ "loginEnabledValue": "yes", # "True" value of above attribute
+ "calendarEnabledAttr": "enable-calendar", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "uid",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groups": {
</span><span class="cx"> "rdn": "cn=Groups",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "", # additional filter for this type
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "", # additional filter for this type
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : ["mail", "emailAliases"],
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": ["mail", "emailAliases"],
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "locations": {
</span><span class="cx"> "rdn": "cn=Places",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : "", # old style, single string
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": "", # old style, single string
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "resources": {
</span><span class="cx"> "rdn": "cn=Resources",
</span><del>- "attr": "cn", # used only to synthesize email address
- "emailSuffix": None, # used only to synthesize email address
- "filter": "(objectClass=apple-resource)", # additional filter for this type
- "calendarEnabledAttr" : "", # attribute controlling calendaring
- "calendarEnabledValue" : "yes", # "True" value of above attribute
- "mapping": { # maps internal record names to LDAP
</del><ins>+ "attr": "cn", # used only to synthesize email address
+ "emailSuffix": None, # used only to synthesize email address
+ "filter": "(objectClass=apple-resource)", # additional filter for this type
+ "calendarEnabledAttr": "", # attribute controlling calendaring
+ "calendarEnabledValue": "yes", # "True" value of above attribute
+ "mapping": { # maps internal record names to LDAP
</ins><span class="cx"> "recordName": "cn",
</span><del>- "fullName" : "cn",
- "emailAddresses" : [], # new style, array
- "firstName" : "givenName",
- "lastName" : "sn",
</del><ins>+ "fullName": "cn",
+ "emailAddresses": [], # new style, array
+ "firstName": "givenName",
+ "lastName": "sn",
</ins><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> },
</span><span class="cx"> "groupSchema": {
</span><del>- "membersAttr": "uniqueMember", # how members are specified
- "nestedGroupsAttr": "", # how nested groups are specified
- "memberIdAttr": "apple-generateduid", # which attribute the above refer to
</del><ins>+ "membersAttr": "uniqueMember", # how members are specified
+ "nestedGroupsAttr": "", # how nested groups are specified
+ "memberIdAttr": "apple-generateduid", # which attribute the above refer to
</ins><span class="cx"> },
</span><span class="cx"> "resourceSchema": {
</span><del>- "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</del><ins>+ "resourceInfoAttr": "apple-resource-info", # contains location/resource info
</ins><span class="cx"> "autoScheduleAttr": None,
</span><span class="cx"> "proxyAttr": None,
</span><span class="cx"> "readOnlyProxyAttr": None,
</span><span class="cx"> "autoAcceptGroupAttr": None,
</span><span class="cx"> },
</span><span class="cx"> "poddingSchema": {
</span><del>- "serverIdAttr": "server-id", # maps to augments server-id
</del><ins>+ "serverIdAttr": "server-id", # maps to augments server-id
</ins><span class="cx"> },
</span><span class="cx"> }
</span><span class="cx"> )
</span><span class="lines">@@ -1304,11 +1313,14 @@
</span><span class="cx"> 'cn': ['Amanda Test']
</span><span class="cx"> }
</span><span class="cx">
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_users)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_users
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid)
</span><del>- self.assertEquals(record.emailAddresses,
- set(['alternate@example.com', 'odtestamanda@example.com']))
</del><ins>+ self.assertEquals(
+ record.emailAddresses,
+ set(['alternate@example.com', 'odtestamanda@example.com'])
+ )
</ins><span class="cx"> self.assertEquals(record.shortNames, ('odtestamanda',))
</span><span class="cx"> self.assertEquals(record.fullName, 'Amanda Test')
</span><span class="cx"> self.assertEquals(record.firstName, 'Amanda')
</span><span class="lines">@@ -1330,8 +1342,9 @@
</span><span class="cx"> 'cn': ['Amanda Test']
</span><span class="cx"> }
</span><span class="cx">
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_users)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_users
+ )
</ins><span class="cx"> self.assertTrue(record.enabledForCalendaring)
</span><span class="cx">
</span><span class="cx"> # User with "podding" info
</span><span class="lines">@@ -1342,11 +1355,12 @@
</span><span class="cx"> 'uid': ['odtestamanda'],
</span><span class="cx"> 'apple-generateduid': [guid],
</span><span class="cx"> 'cn': ['Amanda Test'],
</span><del>- 'server-id' : ["test-server-id"],
</del><ins>+ 'server-id': ["test-server-id"],
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_users)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_users
+ )
</ins><span class="cx"> self.assertEquals(record.serverID, "test-server-id")
</span><span class="cx">
</span><span class="cx"> # User missing guidAttr
</span><span class="lines">@@ -1357,9 +1371,11 @@
</span><span class="cx"> 'cn': ['Amanda Test'],
</span><span class="cx"> }
</span><span class="cx">
</span><del>- self.assertRaises(MissingGuidException,
</del><ins>+ self.assertRaises(
+ MissingGuidException,
</ins><span class="cx"> self.service._ldapResultToRecord, dn, attrs,
</span><del>- self.service.recordType_users)
</del><ins>+ self.service.recordType_users
+ )
</ins><span class="cx">
</span><span class="cx"> # User missing record name
</span><span class="cx">
</span><span class="lines">@@ -1369,9 +1385,11 @@
</span><span class="cx"> 'cn': ['Amanda Test'],
</span><span class="cx"> }
</span><span class="cx">
</span><del>- self.assertRaises(MissingRecordNameException,
</del><ins>+ self.assertRaises(
+ MissingRecordNameException,
</ins><span class="cx"> self.service._ldapResultToRecord, dn, attrs,
</span><del>- self.service.recordType_users)
</del><ins>+ self.service.recordType_users
+ )
</ins><span class="cx">
</span><span class="cx"> # Group with direct user members and nested group
</span><span class="cx">
</span><span class="lines">@@ -1379,23 +1397,26 @@
</span><span class="cx"> guid = '6C6CD280-E6E3-11DF-9492-0800200C9A66'
</span><span class="cx"> attrs = {
</span><span class="cx"> 'apple-generateduid': [guid],
</span><del>- 'uniqueMember':
</del><ins>+ 'uniqueMember': [
+ 'uid=odtestamanda,cn=users,dc=example,dc=com',
+ 'uid=odtestbetty,cn=users,dc=example,dc=com',
+ 'cn=odtestgroupb,cn=groups,dc=example,dc=com',
+ ],
+ 'cn': ['odtestgrouptop']
+ }
+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_groups
+ )
+ self.assertEquals(record.guid, guid)
+ self.assertEquals(
+ record.memberGUIDs(),
+ set(
</ins><span class="cx"> [
</span><ins>+ 'cn=odtestgroupb,cn=groups,dc=example,dc=com',
</ins><span class="cx"> 'uid=odtestamanda,cn=users,dc=example,dc=com',
</span><span class="cx"> 'uid=odtestbetty,cn=users,dc=example,dc=com',
</span><del>- 'cn=odtestgroupb,cn=groups,dc=example,dc=com',
- ],
- 'cn': ['odtestgrouptop']
- }
- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_groups)
- self.assertEquals(record.guid, guid)
- self.assertEquals(record.memberGUIDs(),
- set([
- 'cn=odtestgroupb,cn=groups,dc=example,dc=com',
- 'uid=odtestamanda,cn=users,dc=example,dc=com',
- 'uid=odtestbetty,cn=users,dc=example,dc=com',
- ])
</del><ins>+ ]
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # Group with illegal DN value in members
</span><span class="lines">@@ -1404,22 +1425,25 @@
</span><span class="cx"> guid = '6C6CD280-E6E3-11DF-9492-0800200C9A66'
</span><span class="cx"> attrs = {
</span><span class="cx"> 'apple-generateduid': [guid],
</span><del>- 'uniqueMember':
- [
- 'uid=odtestamanda,cn=users,dc=example,dc=com',
- 'uid=odtestbetty ,cn=users,dc=example,dc=com',
- 'cn=odtestgroupb+foo,cn=groups,dc=example,dc=com',
- ],
</del><ins>+ 'uniqueMember': [
+ 'uid=odtestamanda,cn=users,dc=example,dc=com',
+ 'uid=odtestbetty ,cn=users,dc=example,dc=com',
+ 'cn=odtestgroupb+foo,cn=groups,dc=example,dc=com',
+ ],
</ins><span class="cx"> 'cn': ['odtestgrouptop']
</span><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_groups)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_groups
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid)
</span><del>- self.assertEquals(record.memberGUIDs(),
- set([
- 'uid=odtestamanda,cn=users,dc=example,dc=com',
- 'uid=odtestbetty,cn=users,dc=example,dc=com',
- ])
</del><ins>+ self.assertEquals(
+ record.memberGUIDs(),
+ set(
+ [
+ 'uid=odtestamanda,cn=users,dc=example,dc=com',
+ 'uid=odtestbetty,cn=users,dc=example,dc=com',
+ ]
+ )
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> # Resource with delegates, autoSchedule = True, and autoAcceptGroup
</span><span class="lines">@@ -1447,16 +1471,22 @@
</span><span class="cx"> </dict>
</span><span class="cx"> </plist>"""]
</span><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_resources)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_resources
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid)
</span><del>- self.assertEquals(record.externalProxies(),
- set(['6C6CD280-E6E3-11DF-9492-0800200C9A66']))
- self.assertEquals(record.externalReadOnlyProxies(),
- set(['6AA1AE12-592F-4190-A069-547CD83C47C0']))
</del><ins>+ self.assertEquals(
+ record.externalProxies(),
+ set(['6C6CD280-E6E3-11DF-9492-0800200C9A66'])
+ )
+ self.assertEquals(
+ record.externalReadOnlyProxies(),
+ set(['6AA1AE12-592F-4190-A069-547CD83C47C0'])
+ )
</ins><span class="cx"> self.assertTrue(record.autoSchedule)
</span><del>- self.assertEquals(record.autoAcceptGroup,
- '77A8EB52-AA2A-42ED-8843-B2BEE863AC70')
</del><ins>+ self.assertEquals(
+ record.autoAcceptGroup, '77A8EB52-AA2A-42ED-8843-B2BEE863AC70'
+ )
</ins><span class="cx">
</span><span class="cx"> # Resource with no delegates and autoSchedule = False
</span><span class="cx">
</span><span class="lines">@@ -1477,25 +1507,24 @@
</span><span class="cx"> </dict>
</span><span class="cx"> </plist>"""]
</span><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_resources)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_resources
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid)
</span><del>- self.assertEquals(record.externalProxies(),
- set())
- self.assertEquals(record.externalReadOnlyProxies(),
- set())
</del><ins>+ self.assertEquals(record.externalProxies(), set())
+ self.assertEquals(record.externalReadOnlyProxies(), set())
</ins><span class="cx"> self.assertFalse(record.autoSchedule)
</span><span class="cx"> self.assertEquals(record.autoAcceptGroup, "")
</span><span class="cx">
</span><span class="cx"> # Now switch off the resourceInfoAttr and switch to individual
</span><span class="cx"> # attributes...
</span><span class="cx"> self.service.resourceSchema = {
</span><del>- "resourceInfoAttr" : "",
- "autoScheduleAttr" : "auto-schedule",
- "autoScheduleEnabledValue" : "yes",
- "proxyAttr" : "proxy",
- "readOnlyProxyAttr" : "read-only-proxy",
- "autoAcceptGroupAttr" : "auto-accept-group",
</del><ins>+ "resourceInfoAttr": "",
+ "autoScheduleAttr": "auto-schedule",
+ "autoScheduleEnabledValue": "yes",
+ "proxyAttr": "proxy",
+ "readOnlyProxyAttr": "read-only-proxy",
+ "autoAcceptGroupAttr": "auto-accept-group",
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> # Resource with delegates and autoSchedule = True
</span><span class="lines">@@ -1505,21 +1534,28 @@
</span><span class="cx"> attrs = {
</span><span class="cx"> 'apple-generateduid': [guid],
</span><span class="cx"> 'cn': ['odtestresource'],
</span><del>- 'auto-schedule' : ['yes'],
- 'proxy' : ['6C6CD280-E6E3-11DF-9492-0800200C9A66'],
- 'read-only-proxy' : ['6AA1AE12-592F-4190-A069-547CD83C47C0'],
- 'auto-accept-group' : ['77A8EB52-AA2A-42ED-8843-B2BEE863AC70'],
</del><ins>+ 'auto-schedule': ['yes'],
+ 'proxy': ['6C6CD280-E6E3-11DF-9492-0800200C9A66'],
+ 'read-only-proxy': ['6AA1AE12-592F-4190-A069-547CD83C47C0'],
+ 'auto-accept-group': ['77A8EB52-AA2A-42ED-8843-B2BEE863AC70'],
</ins><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_resources)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_resources
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid)
</span><del>- self.assertEquals(record.externalProxies(),
- set(['6C6CD280-E6E3-11DF-9492-0800200C9A66']))
- self.assertEquals(record.externalReadOnlyProxies(),
- set(['6AA1AE12-592F-4190-A069-547CD83C47C0']))
</del><ins>+ self.assertEquals(
+ record.externalProxies(),
+ set(['6C6CD280-E6E3-11DF-9492-0800200C9A66'])
+ )
+ self.assertEquals(
+ record.externalReadOnlyProxies(),
+ set(['6AA1AE12-592F-4190-A069-547CD83C47C0'])
+ )
</ins><span class="cx"> self.assertTrue(record.autoSchedule)
</span><del>- self.assertEquals(record.autoAcceptGroup,
- '77A8EB52-AA2A-42ED-8843-B2BEE863AC70')
</del><ins>+ self.assertEquals(
+ record.autoAcceptGroup,
+ '77A8EB52-AA2A-42ED-8843-B2BEE863AC70'
+ )
</ins><span class="cx">
</span><span class="cx"> # Record with lowercase guid
</span><span class="cx"> dn = "uid=odtestamanda,cn=users,dc=example,dc=com"
</span><span class="lines">@@ -1532,8 +1568,9 @@
</span><span class="cx"> 'givenName': ['Amanda'],
</span><span class="cx"> 'cn': ['Amanda Test']
</span><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_users)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_users
+ )
</ins><span class="cx"> self.assertEquals(record.guid, guid.upper())
</span><span class="cx">
</span><span class="cx"> # Location with associated Address
</span><span class="lines">@@ -1543,14 +1580,15 @@
</span><span class="cx"> attrs = {
</span><span class="cx"> "apple-generateduid": [guid],
</span><span class="cx"> "cn": ["odtestlocation"],
</span><del>- "assocAddr" : ["6C6CD280-E6E3-11DF-9492-0800200C9A66"],
</del><ins>+ "assocAddr": ["6C6CD280-E6E3-11DF-9492-0800200C9A66"],
</ins><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_locations)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_locations
+ )
</ins><span class="cx"> self.assertEquals(record.extras, {
</span><span class="cx"> "associatedAddress": "6C6CD280-E6E3-11DF-9492-0800200C9A66"
</span><span class="cx"> })
</span><del>-
</del><ins>+
</ins><span class="cx"> # Address with street and geo
</span><span class="cx">
</span><span class="cx"> dn = "cn=odtestaddress,cn=buildings,dc=example,dc=com"
</span><span class="lines">@@ -1558,16 +1596,16 @@
</span><span class="cx"> attrs = {
</span><span class="cx"> "apple-generateduid": [guid],
</span><span class="cx"> "cn": ["odtestaddress"],
</span><del>- "coordinates" : ["geo:1,2"],
- "postal" : ["1 Infinite Loop, Cupertino, CA"],
</del><ins>+ "coordinates": ["geo:1,2"],
+ "postal": ["1 Infinite Loop, Cupertino, CA"],
</ins><span class="cx"> }
</span><del>- record = self.service._ldapResultToRecord(dn, attrs,
- self.service.recordType_addresses)
</del><ins>+ record = self.service._ldapResultToRecord(
+ dn, attrs, self.service.recordType_addresses
+ )
</ins><span class="cx"> self.assertEquals(record.extras, {
</span><span class="cx"> "geo": "geo:1,2",
</span><del>- "streetAddress" : "1 Infinite Loop, Cupertino, CA",
</del><ins>+ "streetAddress": "1 Infinite Loop, Cupertino, CA",
</ins><span class="cx"> })
</span><del>-
</del><span class="cx">
</span><span class="cx"> def test_listRecords(self):
</span><span class="cx"> """
</span><span class="lines">@@ -1580,7 +1618,7 @@
</span><span class="cx"> self.assertEquals(len(records), 4)
</span><span class="cx"> self.assertEquals(
</span><span class="cx"> set([r.firstName for r in records]),
</span><del>- set(["Amanda", "Betty", "Cyrus", "Wilfredo"]) # Carlene is skipped because no guid in LDAP
</del><ins>+ set(["Amanda", "Betty", "Cyrus", "Wilfredo"]) # Carlene is skipped because no guid in LDAP
</ins><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> def test_restrictedPrincipalsUsingDN(self):
</span><span class="lines">@@ -1592,18 +1630,20 @@
</span><span class="cx"> for scenario in (
</span><span class="cx"> self.nestedUsingSameAttributeUsingDN,
</span><span class="cx"> self.nestedUsingDifferentAttributeUsingDN,
</span><del>- ):
</del><ins>+ ):
</ins><span class="cx"> self.setupService(scenario)
</span><span class="cx">
</span><span class="cx"> self.assertEquals(
</span><del>- set([
- "cn=left_coast,cn=groups,dc=example,dc=com",
- "cn=right_coast,cn=groups,dc=example,dc=com",
- "uid=cdaboo,cn=users,dc=example,dc=com",
- "uid=dreid,cn=users,dc=example,dc=com",
- "uid=lecroy,cn=users,dc=example,dc=com",
- "uid=wsanchez,cn=users,dc=example,dc=com",
- ]),
</del><ins>+ set(
+ [
+ "cn=left_coast,cn=groups,dc=example,dc=com",
+ "cn=right_coast,cn=groups,dc=example,dc=com",
+ "uid=cdaboo,cn=users,dc=example,dc=com",
+ "uid=dreid,cn=users,dc=example,dc=com",
+ "uid=lecroy,cn=users,dc=example,dc=com",
+ "uid=wsanchez,cn=users,dc=example,dc=com",
+ ]
+ ),
</ins><span class="cx"> self.service.restrictedPrincipals)
</span><span class="cx">
</span><span class="cx"> dn = "uid=cdaboo,cn=users,dc=example,dc=com"
</span><span class="lines">@@ -1638,16 +1678,18 @@
</span><span class="cx"> for scenario in (
</span><span class="cx"> self.nestedUsingDifferentAttributeUsingGUID,
</span><span class="cx"> self.nestedUsingSameAttributeUsingGUID,
</span><del>- ):
</del><ins>+ ):
</ins><span class="cx"> self.setupService(scenario)
</span><span class="cx">
</span><span class="cx"> self.assertEquals(
</span><del>- set([
- "left_coast",
- "right_coast",
- "5A985493-EE2C-4665-94CF-4DFEA3A89500",
- "6423F94A-6B76-4A3A-815B-D52CFD77935D",
- ]),
</del><ins>+ set(
+ [
+ "left_coast",
+ "right_coast",
+ "5A985493-EE2C-4665-94CF-4DFEA3A89500",
+ "6423F94A-6B76-4A3A-815B-D52CFD77935D",
+ ]
+ ),
</ins><span class="cx"> self.service.restrictedPrincipals)
</span><span class="cx">
</span><span class="cx"> dn = "uid=cdaboo,cn=users,dc=example,dc=com"
</span><span class="lines">@@ -1692,8 +1734,10 @@
</span><span class="cx"> # Set up the GroupMembershipCache
</span><span class="cx"> cache = GroupMembershipCache("ProxyDB", expireSeconds=60)
</span><span class="cx"> self.service.groupMembershipCache = cache
</span><del>- updater = GroupMembershipCacheUpdater(calendaruserproxy.ProxyDBService,
- self.service, 30, 15, 30, cache=cache, useExternalProxies=False)
</del><ins>+ updater = GroupMembershipCacheUpdater(
+ calendaruserproxy.ProxyDBService,
+ self.service, 30, 15, 30, cache=cache, useExternalProxies=False
+ )
</ins><span class="cx">
</span><span class="cx"> self.assertEquals((False, 8, 8), (yield updater.updateCache()))
</span><span class="cx">
</span><span class="lines">@@ -1726,21 +1770,24 @@
</span><span class="cx"> ]
</span><span class="cx"> )
</span><span class="cx">
</span><del>-
</del><span class="cx"> def test_splitIntoBatches(self):
</span><span class="cx"> self.setupService(self.nestedUsingDifferentAttributeUsingDN)
</span><span class="cx"> # Data is perfect multiple of size
</span><span class="cx"> results = list(splitIntoBatches(set(range(12)), 4))
</span><del>- self.assertEquals(results,
- [set([0, 1, 2, 3]), set([4, 5, 6, 7]), set([8, 9, 10, 11])])
</del><ins>+ self.assertEquals(
+ results,
+ [set([0, 1, 2, 3]), set([4, 5, 6, 7]), set([8, 9, 10, 11])]
+ )
</ins><span class="cx">
</span><span class="cx"> # Some left overs
</span><span class="cx"> results = list(splitIntoBatches(set(range(12)), 5))
</span><del>- self.assertEquals(results,
- [set([0, 1, 2, 3, 4]), set([8, 9, 5, 6, 7]), set([10, 11])])
</del><ins>+ self.assertEquals(
+ results,
+ [set([0, 1, 2, 3, 4]), set([8, 9, 5, 6, 7]), set([10, 11])]
+ )
</ins><span class="cx">
</span><span class="cx"> # Empty
</span><del>- results = list(splitIntoBatches(set([]), 5)) # empty data
</del><ins>+ results = list(splitIntoBatches(set([]), 5)) # empty data
</ins><span class="cx"> self.assertEquals(results, [set([])])
</span><span class="cx">
</span><span class="cx"> def test_recordTypeForDN(self):
</span><span class="lines">@@ -1790,7 +1837,8 @@
</span><span class="cx"> self.history = []
</span><span class="cx">
</span><span class="cx"> def stubSearchMethod(base, scope, filterstr="(objectClass=*)",
</span><del>- attrlist=None, timeoutSeconds=-1, resultLimit=0):
</del><ins>+ attrlist=None, timeoutSeconds=-1,
+ resultLimit=0):
</ins><span class="cx"> self.history.append((base, scope, filterstr))
</span><span class="cx">
</span><span class="cx"> recordTypes = [
</span></span></pre>
</div>
</div>
</body>
</html>