1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

python/samba/tests: py2/py3 port has_keys usage

Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Noel Power 2018-05-11 16:37:44 +01:00 committed by Andrew Bartlett
parent fd35e533f1
commit 9e349fe82a
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ class UpgradeProvisionWithLdbTestCase(TestCaseInTempDir):
hashAtt = search_constructed_attrs_stored(self.ldbs.sam,
self.names.rootdn,
["msds-KeyVersionNumber"])
self.assertFalse(hashAtt.has_key("msds-KeyVersionNumber"))
self.assertFalse("msds-KeyVersionNumber" in hashAtt)
def test_increment_calculated_keyversion_number(self):
dn = "CN=Administrator,CN=Users,%s" % self.names.rootdn

View File

@ -489,7 +489,7 @@ def increment_calculated_keyversion_number(samdb, rootdn, hashDns):
raise ProvisioningError("Unable to find msDs-KeyVersionNumber")
else:
for e in entry:
if hashDns.has_key(str(e.dn).lower()):
if str(e.dn).lower() in hashDns:
val = e.get("msDs-KeyVersionNumber")
if not val:
val = "0"
@ -689,7 +689,7 @@ def search_constructed_attrs_stored(samdb, rootdn, attrs):
for ent in entry:
for att in attrs:
if ent.get(att):
if hashAtt.has_key(att):
if att in hashAtt:
hashAtt[att][str(ent.dn).lower()] = str(ent[att])
else:
hashAtt[att] = {}