diff options
author | Andrew Bartlett <abartlet@samba.org> | 2018-09-02 17:34:03 +1200 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2018-09-03 03:22:25 +0200 |
commit | a740a6131c967f9640b19a6964fd5d6f85ce853a (patch) | |
tree | ac2ac90f03373c3d88d9a21f8943cd7c4ad36092 | |
parent | 9eb26065d0c64c21bf09023d0c199445adb7e8a8 (diff) | |
download | samba-a740a6131c967f9640b19a6964fd5d6f85ce853a.tar.gz |
selftest: Prepare to allow override of lockout duration in password_lockout tests
This will make it easier to avoid flapping tests.
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
-rwxr-xr-x | source4/dsdb/tests/python/password_lockout.py | 9 | ||||
-rw-r--r-- | source4/dsdb/tests/python/password_lockout_base.py | 11 |
2 files changed, 13 insertions, 7 deletions
diff --git a/source4/dsdb/tests/python/password_lockout.py b/source4/dsdb/tests/python/password_lockout.py index 72455acd04f..be3e3fa53e2 100755 --- a/source4/dsdb/tests/python/password_lockout.py +++ b/source4/dsdb/tests/python/password_lockout.py @@ -600,15 +600,14 @@ userPassword: thatsAcomplPASS2XYZ initial_lastlogon_relation='greater') def use_pso_lockout_settings(self, creds): + # create a PSO with the lockout settings the test cases normally expect + # + # Some test cases sleep() for self.account_lockout_duration pso = PasswordSettings("lockout-PSO", self.ldb, lockout_attempts=3, - lockout_duration=3) + lockout_duration=self.account_lockout_duration) self.addCleanup(self.ldb.delete, pso.dn) - # the test cases should sleep() for the PSO's lockoutDuration/obsvWindow - self.account_lockout_duration = 3 - self.lockout_observation_window = 3 - userdn = "cn=%s,cn=users,%s" % (creds.get_username(), self.base_dn) pso.apply_to(userdn) diff --git a/source4/dsdb/tests/python/password_lockout_base.py b/source4/dsdb/tests/python/password_lockout_base.py index 7308f6723bd..c2664e9adba 100644 --- a/source4/dsdb/tests/python/password_lockout_base.py +++ b/source4/dsdb/tests/python/password_lockout_base.py @@ -321,8 +321,15 @@ lockoutThreshold: """ + str(lockoutThreshold) + """ """) self.base_dn = self.ldb.domain_dn() - self.account_lockout_duration = 3 - self.lockout_observation_window = 3 + + # + # Some test cases sleep() for self.account_lockout_duration + # so allow it to be controlled via the subclass + # + if not hasattr(self, 'account_lockout_duration'): + self.account_lockout_duration = 3 + if not hasattr(self, 'lockout_observation_window'): + self.lockout_observation_window = 3 self.update_lockout_settings(threshold=3, duration=self.account_lockout_duration, observation_window=self.lockout_observation_window) |