def testSimple(self): client = LDAPClientTestDriver( [ pureldap.LDAPSearchResultEntry( objectName='', attributes=( ('subschemaSubentry', ['cn=Subschema']), ('bar', ['b', 'c']), ), ), pureldap.LDAPSearchResultDone( resultCode=0, matchedDN='', errorMessage='') ], [ pureldap.LDAPSearchResultEntry( objectName='cn=Subschema', attributes=( ('attributeTypes', [self.cn]), ('objectClasses', [self.dcObject]), ), ), pureldap.LDAPSearchResultDone( resultCode=0, matchedDN='', errorMessage='') ], ) d = fetchschema.fetch(client, 'dc=example,dc=com') d.addCallback(self._cb_testSimple, client) return d
def testSimple(self): client = LDAPClientTestDriver( [ pureldap.LDAPSearchResultEntry( objectName="", attributes=( ("subschemaSubentry", ["cn=Subschema"]), ("bar", ["b", "c"]), ), ), pureldap.LDAPSearchResultDone( resultCode=0, matchedDN="", errorMessage=""), ], [ pureldap.LDAPSearchResultEntry( objectName="cn=Subschema", attributes=( ("attributeTypes", [self.cn]), ("objectClasses", [self.dcObject]), ), ), pureldap.LDAPSearchResultDone( resultCode=0, matchedDN="", errorMessage=""), ], ) d = fetchschema.fetch(client, "dc=example,dc=com") d.addCallback(self._cb_testSimple, client) return d
def getResource(baseObject, request): entry = request.getSession().getLoggedInRoot().loggedIn client = entry.client d = fetchschema.fetch(client, baseObject) def cbAddPage(schema): attributeTypes, objectClasses = schema return AddPage(attributeTypes, objectClasses) d.addCallback(cbAddPage) return d
def testSimple(self): d = fetchschema.fetch(self.client, 'dc=example,dc=com') (attributeTypes, objectClasses) = util.pumpingDeferredResult(d) self.failUnlessEqual( [to_bytes(x) for x in attributeTypes], [to_bytes(schema.AttributeTypeDescription(x)) for x in [ test_schema.AttributeType_KnownValues.knownValues[0][0]]]) self.failUnlessEqual( [to_bytes(x) for x in objectClasses], [to_bytes(schema.ObjectClassDescription(x)) for x in [ test_schema.OBJECTCLASSES['organization'], test_schema.OBJECTCLASSES['organizationalUnit']]])
def _getSchema(entry): d = fetchschema.fetch(entry.client, entry.dn) def cb((attributeTypes, objectClasses), entry): return (entry, attributeTypes, objectClasses)
def _cbBound(client, baseDN): d = fetchschema.fetch(client, baseDN) return d