From: Garming Sam Date: Thu, 14 Jul 2016 04:56:50 +0000 (+1200) Subject: link_attrs: Add tests for one way links (and pseudo one-way) X-Git-Tag: tdb-1.3.10~384 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=00e828a8a8bf56b93fe650faaa9652081ebd27f7;p=thirdparty%2Fsamba.git link_attrs: Add tests for one way links (and pseudo one-way) Tested against Win2012R2. The deactivated link control has no effect on either one way links or pseudo ones (only two-way ones presumably). Signed-off-by: Garming Sam Reviewed-by: Andrew Bartlett --- diff --git a/selftest/knownfail b/selftest/knownfail index 1a92a5d3198..74543dd75dd 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -285,3 +285,6 @@ # fl2000dc doesn't support AES ^samba4.krb5.kdc.*as-req-aes.*fl2000dc + +^samba4.ldap.linked_attributes.python\(ad_dc_ntvfs\).__main__.LATests.test_one_way_attributes\(ad_dc_ntvfs:local\) +^samba4.ldap.linked_attributes.python\(ad_dc_ntvfs\).__main__.LATests.test_pretend_one_way_attributes\(ad_dc_ntvfs:local\) diff --git a/source4/dsdb/tests/python/linked_attributes.py b/source4/dsdb/tests/python/linked_attributes.py index c7afad4d862..cea3a010652 100644 --- a/source4/dsdb/tests/python/linked_attributes.py +++ b/source4/dsdb/tests/python/linked_attributes.py @@ -352,6 +352,74 @@ class LATests(samba.tests.TestCase): self.assert_back_links(u2, [g3, g2], sorted=True) self.assert_back_links(u3, [g3, g2, g1], sorted=True) + def test_one_way_attributes(self): + e1, e2 = self.add_objects(2, 'msExchConfigurationContainer', + 'e_one_way') + guid = self.get_object_guid(e2) + + self.add_linked_attribute(e1, e2, attr="addressBookRoots") + self.assert_forward_links(e1, [e2], attr='addressBookRoots') + + self.samdb.delete(e2) + + res = self.samdb.search("" % guid, + scope=ldb.SCOPE_BASE, + controls=['show_deleted:1', + 'show_recycled:1']) + + new_dn = str(res[0].dn) + self.assert_forward_links(e1, [new_dn], attr='addressBookRoots') + self.assert_forward_links(e1, [new_dn], + attr='addressBookRoots', + show_deactivated_link=0) + + def test_one_way_attributes_delete_link(self): + e1, e2 = self.add_objects(2, 'msExchConfigurationContainer', + 'e_one_way') + guid = self.get_object_guid(e2) + + self.add_linked_attribute(e1, e2, attr="addressBookRoots") + self.assert_forward_links(e1, [e2], attr='addressBookRoots') + + self.remove_linked_attribute(e1, e2, attr="addressBookRoots") + + self.assert_forward_links(e1, [], attr='addressBookRoots') + self.assert_forward_links(e1, [], attr='addressBookRoots', + show_deactivated_link=0) + + def test_pretend_one_way_attributes(self): + e1, e2 = self.add_objects(2, 'msExchConfigurationContainer', + 'e_one_way') + guid = self.get_object_guid(e2) + + self.add_linked_attribute(e1, e2, attr="addressBookRoots2") + self.assert_forward_links(e1, [e2], attr='addressBookRoots2') + + self.samdb.delete(e2) + res = self.samdb.search("" % guid, + scope=ldb.SCOPE_BASE, + controls=['show_deleted:1', + 'show_recycled:1']) + + new_dn = str(res[0].dn) + + self.assert_forward_links(e1, [], attr='addressBookRoots2') + self.assert_forward_links(e1, [], attr='addressBookRoots2', + show_deactivated_link=0) + + def test_pretend_one_way_attributes_delete_link(self): + e1, e2 = self.add_objects(2, 'msExchConfigurationContainer', + 'e_one_way') + guid = self.get_object_guid(e2) + + self.add_linked_attribute(e1, e2, attr="addressBookRoots2") + self.assert_forward_links(e1, [e2], attr='addressBookRoots2') + + self.remove_linked_attribute(e1, e2, attr="addressBookRoots2") + + self.assert_forward_links(e1, [], attr='addressBookRoots2') + self.assert_forward_links(e1, [], attr='addressBookRoots2', + show_deactivated_link=0) if "://" not in host: if os.path.isfile(host):