Пример #1
0
 def testAddTopLevel(self):
     e = BaseLDAPEntry(dn='dc=org',
                       attributes={
                           'objectClass': ['dcObject'],
                           'dc': ['org'],
                       })
     d = ldiftree.put(self.tree, e)
     d.addCallback(self._cb_testAddTopLevel)
     return d
Пример #2
0
 def testDirCreation(self):
     e = BaseLDAPEntry(dn='cn=create-me,ou=OrgUnit,dc=example,dc=com',
                       attributes={
                           'objectClass': ['top'],
                           'cn': ['create-me'],
                       })
     d = ldiftree.put(self.tree, e)
     d.addCallback(self._cb_testDirCreation)
     return d
Пример #3
0
 def testSimpleWrite(self):
     e = BaseLDAPEntry(dn='cn=foo,dc=example,dc=com',
                       attributes={
                           'objectClass': ['top'],
                           'cn': ['foo'],
                       })
     d = ldiftree.put(self.tree, e)
     d.addCallback(self._cb_testSimpleWrite)
     return d
Пример #4
0
 def testMissingLinkError(self):
     e = BaseLDAPEntry(
         dn='cn=bad-create,ou=NoSuchOrgUnit,dc=example,dc=com',
         attributes={
             'objectClass': ['top'],
             'cn': ['bad-create'],
         })
     d = ldiftree.put(self.tree, e)
     d.addCallbacks(self._cb_testMissingLinkError,
                    self._eb_testMissingLinkError)
     return d
Пример #5
0
 def testDirExists(self):
     e = BaseLDAPEntry(dn='cn=create-me,ou=OrgUnit,dc=example,dc=com',
                       attributes={
                           'objectClass': ['top'],
                           'cn': ['create-me'],
                       })
     dirpath = os.path.join(self.tree, 'dc=com.dir', 'dc=example.dir',
                            'ou=OrgUnit.dir')
     os.mkdir(dirpath)
     d = ldiftree.put(self.tree, e)
     d.addCallback(self._cb_testDirExists, dirpath)
     return d
Пример #6
0
    def test_diffTree_addChild(self):
        otherDir = self.mktemp()
        shutil.copytree(self.tree, otherDir)
        other = ldiftree.LDIFTreeEntry(otherDir)
        e = entry.BaseLDAPEntry(dn='cn=foo,dc=example,dc=com')
        d = ldiftree.put(otherDir, e)

        def cb1(dummy):
            return other.lookup('cn=foo,dc=example,dc=com')

        d.addCallback(cb1)

        def cb2(r):
            d = self.root.diffTree(other)
            d.addCallback(self.assertEquals, [delta.AddOp(r)])
            return d

        d.addCallback(cb2)
        return d