mirror of
https://github.com/samba-team/samba.git
synced 2025-07-29 15:42:04 +03:00
tests: Factor out prep_creds()
3 times the same code can be put together Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
committed by
Jeremy Allison
parent
7457674396
commit
fec5a569b6
@ -51,8 +51,7 @@ class LibsmbTestCase(samba.tests.TestCase):
|
||||
except Exception:
|
||||
self.exc = sys.exc_info()
|
||||
|
||||
def test_OpenClose(self):
|
||||
|
||||
def prep_creds(self):
|
||||
lp = s3param.get_context()
|
||||
lp.load(os.getenv("SMB_CONF_PATH"))
|
||||
|
||||
@ -61,6 +60,11 @@ class LibsmbTestCase(samba.tests.TestCase):
|
||||
creds.set_username(os.getenv("USERNAME"))
|
||||
creds.set_password(os.getenv("PASSWORD"))
|
||||
|
||||
return (lp,creds)
|
||||
|
||||
def test_OpenClose(self):
|
||||
(lp,creds) = self.prep_creds()
|
||||
|
||||
c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp",
|
||||
lp, creds, multi_threaded=True,
|
||||
force_smb1=True)
|
||||
@ -82,13 +86,7 @@ class LibsmbTestCase(samba.tests.TestCase):
|
||||
def test_SMB3EncryptionRequired(self):
|
||||
test_dir = 'testing_%d' % random.randint(0, 0xFFFF)
|
||||
|
||||
lp = s3param.get_context()
|
||||
lp.load(os.getenv("SMB_CONF_PATH"))
|
||||
|
||||
creds = credentials.Credentials()
|
||||
creds.guess(lp)
|
||||
creds.set_username(os.getenv("USERNAME"))
|
||||
creds.set_password(os.getenv("PASSWORD"))
|
||||
(lp,creds) = self.prep_creds()
|
||||
creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED)
|
||||
|
||||
c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp",
|
||||
@ -100,13 +98,7 @@ class LibsmbTestCase(samba.tests.TestCase):
|
||||
def test_SMB1EncryptionRequired(self):
|
||||
test_dir = 'testing_%d' % random.randint(0, 0xFFFF)
|
||||
|
||||
lp = s3param.get_context()
|
||||
lp.load(os.getenv("SMB_CONF_PATH"))
|
||||
|
||||
creds = credentials.Credentials()
|
||||
creds.guess(lp)
|
||||
creds.set_username(os.getenv("USERNAME"))
|
||||
creds.set_password(os.getenv("PASSWORD"))
|
||||
(lp,creds) = self.prep_creds()
|
||||
creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED)
|
||||
|
||||
c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp",
|
||||
|
Reference in New Issue
Block a user