diff options
author | Matthieu Patou <mat@matws.net> | 2010-06-22 20:03:15 +0400 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-07-15 22:08:20 +1000 |
commit | f97c90c9cd124314b4a0862e702dd021bd2df9a0 (patch) | |
tree | 42b8c04f5eb77888f2d16037608be569fcd32c5f /source4/scripting/python/samba/tests/dsdb.py | |
parent | 6a0856da9cc075acaa7fcb6bad614f8f403df9c7 (diff) | |
download | samba-f97c90c9cd124314b4a0862e702dd021bd2df9a0.tar.gz samba-f97c90c9cd124314b4a0862e702dd021bd2df9a0.tar.xz samba-f97c90c9cd124314b4a0862e702dd021bd2df9a0.zip |
s4 python: Add functions to samdb to manipulate version of replPropertyMetaData attribute
This change contains also helpers for attribute id to attribute oid
conversion and from attribute id to attribute name.
It brings also unit tests
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'source4/scripting/python/samba/tests/dsdb.py')
-rw-r--r-- | source4/scripting/python/samba/tests/dsdb.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/source4/scripting/python/samba/tests/dsdb.py b/source4/scripting/python/samba/tests/dsdb.py index d28be829847..4a50c96e256 100644 --- a/source4/scripting/python/samba/tests/dsdb.py +++ b/source4/scripting/python/samba/tests/dsdb.py @@ -25,7 +25,7 @@ from samba.ndr import ndr_unpack, ndr_pack from samba.dcerpc import drsblobs import ldb import os -import samba.dsdb +import samba class DsdbTests(TestCase): @@ -107,3 +107,27 @@ class DsdbTests(TestCase): msg.dn = res[0].dn msg["replPropertyMetaData"] = ldb.MessageElement(replBlob, ldb.FLAG_MOD_REPLACE, "replPropertyMetaData") self.samdb.modify(msg, ["local_oid:1.3.6.1.4.1.7165.4.3.14:0"]) + + def test_ok_get_attribute_from_attid(self): + self.assertEquals(self.samdb.get_attribute_from_attid(13), "description") + + def test_ko_get_attribute_from_attid(self): + self.assertEquals(self.samdb.get_attribute_from_attid(11979), None) + + def test_get_attribute_replmetadata_version(self): + res = self.samdb.search(expression="cn=Administrator", + scope=ldb.SCOPE_SUBTREE, + attrs=["dn"]) + self.assertEquals(len(res), 1) + dn = str(res[0].dn) + self.assertEqual(self.samdb.get_attribute_replmetadata_version(dn, "unicodePwd"), 1) + + def test_set_attribute_replmetadata_version(self): + res = self.samdb.search(expression="cn=Administrator", + scope=ldb.SCOPE_SUBTREE, + attrs=["dn"]) + self.assertEquals(len(res), 1) + dn = str(res[0].dn) + version = self.samdb.get_attribute_replmetadata_version(dn, "description") + self.samdb.set_attribute_replmetadata_version(dn, "description", version + 2) + self.assertEqual(self.samdb.get_attribute_replmetadata_version(dn, "description"), version + 2) |