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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
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
Exemplo n.º 4
0
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
Exemplo n.º 5
0
    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']]])
Exemplo n.º 6
0
 def _getSchema(entry):
     d = fetchschema.fetch(entry.client, entry.dn)
     def cb((attributeTypes, objectClasses), entry):
         return (entry, attributeTypes, objectClasses)
Exemplo n.º 7
0
 def _cbBound(client, baseDN):
     d = fetchschema.fetch(client, baseDN)
     return d