1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

s4:dsdb/tests: let password_lockout.py copy user{name,pass} from the template in insta_creds()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Stefan Metzmacher 2016-02-05 08:37:53 +01:00 committed by Andrew Bartlett
parent 2c4612243a
commit 4b35d540fa

View File

@ -57,7 +57,28 @@ global_creds = credopts.get_credentials(lp)
global_creds.set_gensec_features(global_creds.get_gensec_features() |
gensec.FEATURE_SEAL)
def insta_creds(template=global_creds, username="testuser", userpass="thatsAcomplPASS1"):
template_creds = Credentials()
template_creds.set_username("testuser")
template_creds.set_password("thatsAcomplPASS1")
template_creds.set_domain(global_creds.get_domain())
template_creds.set_realm(global_creds.get_realm())
template_creds.set_workstation(global_creds.get_workstation())
template_creds.set_gensec_features(global_creds.get_gensec_features())
template_creds.set_kerberos_state(global_creds.get_kerberos_state())
def insta_creds(template=template_creds, username=None, userpass=None, kerberos_state=None):
if username is not None:
assert userpass is not None
if username is None:
assert userpass is None
username = template.get_username()
userpass = template.get_password()
if kerberos_state is None:
kerberos_state = template.get_kerberos_state()
# get a copy of the global creds or a the passed in creds
c = Credentials()
c.set_username(username)
@ -67,7 +88,7 @@ def insta_creds(template=global_creds, username="testuser", userpass="thatsAcomp
c.set_workstation(template.get_workstation())
c.set_gensec_features(c.get_gensec_features()
| gensec.FEATURE_SEAL)
c.set_kerberos_state(template.get_kerberos_state())
c.set_kerberos_state(kerberos_state)
return c
#