1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

tests/krb5/kdc_base_test.py: Remove 'credentials' class attribute

Credentials for tests are now obtained using the get_user_creds()
method.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Joseph Sutton 2021-06-16 11:31:26 +12:00 committed by Stefan Metzmacher
parent 4f5566be48
commit 364f1ce8d8
2 changed files with 5 additions and 23 deletions

View File

@ -67,28 +67,8 @@ class KDCBaseTest(RawKerberosTest):
@classmethod
def setUpClass(cls):
cls.lp = cls.get_loadparm(cls)
cls.username = os.environ["USERNAME"]
cls.password = os.environ["PASSWORD"]
cls.host = os.environ["SERVER"]
c = Credentials()
c.set_username(cls.username)
c.set_password(cls.password)
try:
realm = os.environ["REALM"]
c.set_realm(realm)
except KeyError:
pass
try:
domain = os.environ["DOMAIN"]
c.set_domain(domain)
except KeyError:
pass
c.guess()
cls.credentials = c
cls._ldb = None
# A set containing DNs of accounts created as part of testing.
@ -111,10 +91,12 @@ class KDCBaseTest(RawKerberosTest):
def get_samdb(self):
if self._ldb is None:
creds = self.get_user_creds()
session = system_session()
type(self)._ldb = SamDB(url="ldap://%s" % self.host,
session_info=session,
credentials=self.credentials,
credentials=creds,
lp=self.lp)
return self._ldb

View File

@ -211,7 +211,7 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest):
samdb = self.get_samdb()
user_name = "mskileusr"
upn_name = "mskileupn"
upn = upn_name + "@" + self.credentials.get_realm().lower()
upn = upn_name + "@" + self.get_user_creds().get_realm().lower()
(uc, dn) = self.create_account(samdb, user_name, upn=upn)
realm = uc.get_realm().lower()
@ -455,7 +455,7 @@ class MS_Kile_Client_Principal_Lookup_Tests(KDCBaseTest):
samdb = self.get_samdb()
user_name = "mskileusr"
upn_name = "mskileupn"
upn = upn_name + "@" + self.credentials.get_realm().lower()
upn = upn_name + "@" + self.get_user_creds().get_realm().lower()
(uc, dn) = self.create_account(samdb, user_name, upn=upn)
realm = uc.get_realm().lower()