diff options
author | Nadezhda Ivanova <nivanova@samba.org> | 2010-11-23 11:21:47 +0200 |
---|---|---|
committer | Nadezhda Ivanova <nivanova@samba.org> | 2010-11-23 11:22:26 +0200 |
commit | c252dac1b3263361ddac87e782c2230679f22589 (patch) | |
tree | c96f5973a3b59cd1e015198b8d90f702b4249de6 /source4 | |
parent | d6679cb75a68b85c5dc28b5633bead84cc2deba9 (diff) | |
download | samba-c252dac1b3263361ddac87e782c2230679f22589.tar.gz samba-c252dac1b3263361ddac87e782c2230679f22589.tar.bz2 samba-c252dac1b3263361ddac87e782c2230679f22589.zip |
s4-tests: Password tests now use the get_dsheuristics and set_dsheuristics from SamDB.
Diffstat (limited to 'source4')
-rwxr-xr-x | source4/dsdb/tests/python/passwords.py | 53 |
1 files changed, 9 insertions, 44 deletions
diff --git a/source4/dsdb/tests/python/passwords.py b/source4/dsdb/tests/python/passwords.py index 1512346402..17eedb27c7 100755 --- a/source4/dsdb/tests/python/passwords.py +++ b/source4/dsdb/tests/python/passwords.py @@ -820,11 +820,7 @@ userPassword: thatsAcomplPASS4 print "Performs testing about the standard 'userPassword' behaviour" # Delete the "dSHeuristics" - m = Message() - m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) - m["dSHeuristics"] = MessageElement([], FLAG_MOD_DELETE, "dsHeuristics") - ldb.modify(m) + ldb.set_dsheuristics(None) time.sleep(1) # This switching time is strictly needed! @@ -864,12 +860,7 @@ userPassword: thatsAcomplPASS4 self.assertFalse("userPassword" in res[0]) # Set the test "dSHeuristics" to deactivate "userPassword" pwd changes - m = Message() - m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) - m["dSHeuristics"] = MessageElement("000000000", FLAG_MOD_REPLACE, - "dSHeuristics") - ldb.modify(m) + ldb.set_dsheuristics("000000000") m = Message() m.dn = Dn(ldb, "cn=testuser,cn=users," + self.base_dn) @@ -884,12 +875,7 @@ userPassword: thatsAcomplPASS4 self.assertEquals(res[0]["userPassword"][0], "myPassword3") # Set the test "dSHeuristics" to deactivate "userPassword" pwd changes - m = Message() - m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) - m["dSHeuristics"] = MessageElement("000000002", FLAG_MOD_REPLACE, - "dSHeuristics") - ldb.modify(m) + ldb.set_dsheuristics("000000002") m = Message() m.dn = Dn(ldb, "cn=testuser,cn=users," + self.base_dn) @@ -904,12 +890,7 @@ userPassword: thatsAcomplPASS4 self.assertEquals(res[0]["userPassword"][0], "myPassword4") # Reset the test "dSHeuristics" (reactivate "userPassword" pwd changes) - m = Message() - m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) - m["dSHeuristics"] = MessageElement("000000001", FLAG_MOD_REPLACE, - "dSHeuristics") - ldb.modify(m) + ldb.set_dsheuristics("000000001") def tearDown(self): super(PasswordTests, self).tearDown() @@ -928,27 +909,19 @@ ldb = SamDB(url=host, session_info=system_session(), credentials=creds, lp=lp) # Gets back the basedn base_dn = ldb.domain_dn() + # Gets back the configuration basedn configuration_dn = ldb.get_config_basedn().get_linearized() # Get the old "dSHeuristics" if it was set -res = ldb.search("CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn, scope=SCOPE_BASE, attrs=["dSHeuristics"]) -if "dSHeuristics" in res[0]: - dsheuristics = res[0]["dSHeuristics"][0] -else: - dsheuristics = None +dsheuristics = ldb.get_dsheuristics() # Set the "dSHeuristics" to activate the correct "userPassword" behaviour -m = Message() -m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) -m["dSHeuristics"] = MessageElement("000000001", FLAG_MOD_REPLACE, - "dSHeuristics") -ldb.modify(m) +ldb.set_dsheuristics("000000001") # Get the old "minPwdAge" minPwdAge = ldb.get_minPwdAge() + # Set it temporarely to "0" ldb.set_minPwdAge("0") @@ -958,15 +931,7 @@ if not runner.run(unittest.makeSuite(PasswordTests)).wasSuccessful(): rc = 1 # Reset the "dSHeuristics" as they were before -m = Message() -m.dn = Dn(ldb, "CN=Directory Service, CN=Windows NT, CN=Services, " - + configuration_dn) -if dsheuristics is not None: - m["dSHeuristics"] = MessageElement(dsheuristics, FLAG_MOD_REPLACE, - "dSHeuristics") -else: - m["dSHeuristics"] = MessageElement([], FLAG_MOD_DELETE, "dsHeuristics") -ldb.modify(m) +ldb.set_dsheuristics(dsheuristics) # Reset the "minPwdAge" as it was before ldb.set_minPwdAge(minPwdAge) |