diff options
author | Matthieu Patou <mat@matws.net> | 2010-06-15 12:53:18 +0400 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2010-06-20 00:43:09 +0200 |
commit | 59f17f9e64f4fdf4a63440e20d6b30008072b4df (patch) | |
tree | 575f1a7d76459cbb6012d159845375c000d676b6 | |
parent | 75389cecdde884356e222e3f846e7358f82c20c0 (diff) | |
download | samba-59f17f9e64f4fdf4a63440e20d6b30008072b4df.tar.gz samba-59f17f9e64f4fdf4a63440e20d6b30008072b4df.tar.bz2 samba-59f17f9e64f4fdf4a63440e20d6b30008072b4df.zip |
s4 unittests: add unit tests for upgradehelpers
The functions tested are:
* construct_existor_expr
* search_constructed_attrs_stored
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r-- | source4/scripting/python/samba/tests/upgradeprovision.py | 15 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/upgradeprovisionneeddc.py | 8 |
2 files changed, 19 insertions, 4 deletions
diff --git a/source4/scripting/python/samba/tests/upgradeprovision.py b/source4/scripting/python/samba/tests/upgradeprovision.py index c5e1094e0d..f0306fe6a1 100644 --- a/source4/scripting/python/samba/tests/upgradeprovision.py +++ b/source4/scripting/python/samba/tests/upgradeprovision.py @@ -18,9 +18,9 @@ # import os -from samba.upgradehelpers import usn_in_range, dn_sort,\ - get_diff_sddls, update_secrets - +from samba.upgradehelpers import (usn_in_range, dn_sort, + get_diff_sddls, update_secrets, + construct_existor_expr) from samba.tests.provision import create_dummy_secretsdb from samba.tests import env_loadparm, TestCaseInTempDir @@ -89,6 +89,15 @@ class UpgradeProvisionTestCase(TestCaseInTempDir): txt = get_diff_sddls(sddl, sddl5) self.assertEquals(txt ,"\tCurrent ACL hasn't a sacl part\n") + def test_construct_existor_expr(self): + res = construct_existor_expr([]) + self.assertEquals(res, "") + + res = construct_existor_expr(["foo"]) + self.assertEquals(res, "(|(foo=*))") + + res = construct_existor_expr(["foo", "bar"]) + self.assertEquals(res, "(|(foo=*)(bar=*))") class UpdateSecretsTests(samba.tests.TestCaseInTempDir): def setUp(self): diff --git a/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py b/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py index 32fad14765..32d6c0975b 100644 --- a/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py +++ b/source4/scripting/python/samba/tests/upgradeprovisionneeddc.py @@ -26,7 +26,7 @@ from samba.provision import getpolicypath from samba.upgradehelpers import (get_paths, get_ldbs, find_provision_key_parameters, identic_rename, updateOEMInfo, getOEMInfo, update_gpo, - delta_update_basesamdb) + delta_update_basesamdb,search_constructed_attrs_stored) from samba.tests.provision import create_dummy_secretsdb from samba import param @@ -82,6 +82,12 @@ class UpgradeProvisionWithLdbTestCase(TestCaseInTempDir): self.referencedb = create_dummy_secretsdb( os.path.join(self.tempdir, "ref.ldb")) + + def test_search_constructed_attrs_stored(self): + hashAtt = search_constructed_attrs_stored(self.ldbs.sam, + self.names.rootdn, + ["msds-KeyVersionNumber"]) + self.assertFalse(hashAtt.has_key("msds-KeyVersionNumber")) def test_identic_rename(self): rootdn = "DC=samba,DC=example,DC=com" |