1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

python: fix mutable default arguments

Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Joseph Sutton <josephsutton@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 23 23:33:46 UTC 2023 on atb-devel-224
This commit is contained in:
Rob van der Linde
2023-02-23 15:54:37 +13:00
committed by Andrew Bartlett
parent e7c87b1d9b
commit 5cb8805811
26 changed files with 243 additions and 66 deletions

View File

@@ -1100,8 +1100,10 @@ sAMAccountName: %s
self.assertCmdSuccess(result, out, err, "Error running user unlock")
self.assertEqual(err, "", "Shouldn't be any error messages")
def _randomUser(self, base={}):
def _randomUser(self, base=None):
"""create a user with random attribute values, you can specify base attributes"""
if base is None:
base = {}
user = {
"name": self.randomName(),
"password": self.random_password(16),
@@ -1117,9 +1119,11 @@ sAMAccountName: %s
user.update(base)
return user
def _randomPosixUser(self, base={}):
def _randomPosixUser(self, base=None):
"""create a user with random attribute values and additional RFC2307
attributes, you can specify base attributes"""
if base is None:
base = {}
user = self._randomUser({})
user.update(base)
posixAttributes = {
@@ -1135,9 +1139,11 @@ sAMAccountName: %s
user.update(base)
return user
def _randomUnixUser(self, base={}):
def _randomUnixUser(self, base=None):
"""create a user with random attribute values and additional RFC2307
attributes, you can specify base attributes"""
if base is None:
base = {}
user = self._randomUser({})
user.update(base)
posixAttributes = {