mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
auth/credentials/tests: Python 3.6 avoid deepcopy error
In PY3 both deepcopy & (shallow)copy fail with Traceback (most recent call last): File "auth/credentials/tests/bind.py", line 42, in <module> creds_machine = copy.copy(creds) File "/usr/lib64/python3.6/copy.py", line 96, in copy rv = reductor(4) TypeError: can't pickle credentials.Credentials objects This patch avoids the nasty copies but creating and populating the Credential objects instead of copying Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
b209def154
commit
cc11f71820
@ -19,6 +19,13 @@ from ldb import SCOPE_BASE, SCOPE_SUBTREE
|
||||
from samba import gensec
|
||||
import samba.tests
|
||||
from samba.tests import delete_force
|
||||
from samba.credentials import Credentials
|
||||
|
||||
def create_credential(lp, other):
|
||||
c = Credentials()
|
||||
c.guess(lp)
|
||||
c.set_gensec_features(other.get_gensec_features())
|
||||
return c
|
||||
|
||||
parser = optparse.OptionParser("ldap [options] <host>")
|
||||
sambaopts = options.SambaOptions(parser)
|
||||
@ -39,12 +46,12 @@ host = args[0]
|
||||
lp = sambaopts.get_loadparm()
|
||||
creds = credopts.get_credentials(lp)
|
||||
creds.set_gensec_features(creds.get_gensec_features() | gensec.FEATURE_SEAL)
|
||||
creds_machine = copy.deepcopy(creds)
|
||||
creds_user1 = copy.deepcopy(creds)
|
||||
creds_user2 = copy.deepcopy(creds)
|
||||
creds_user3 = copy.deepcopy(creds)
|
||||
creds_user4 = copy.deepcopy(creds)
|
||||
|
||||
creds_machine = create_credential(lp, creds)
|
||||
creds_user1 = create_credential(lp, creds)
|
||||
creds_user2 = create_credential(lp, creds)
|
||||
creds_user3 = create_credential(lp, creds)
|
||||
creds_user4 = create_credential(lp, creds)
|
||||
|
||||
class BindTests(samba.tests.TestCase):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user