python/samba/tests: py2/py3 port has_keys usage
authorNoel Power <noel.power@suse.com>
Fri, 11 May 2018 15:37:44 +0000 (16:37 +0100)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 19 Jun 2018 22:18:21 +0000 (00:18 +0200)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/upgradeprovisionneeddc.py
python/samba/upgradehelpers.py

index bf254531510a85554148f9b19f65d75ca21940ec..21c08ab4218ee25e77bdb3f910c57cab3124aa56 100644 (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
index 14fe3e024c319ddc9774e504583bb1832077848c..5e5655d74a2b4d36d1ac26c7ed2ccd0cbed29814 100644 (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] = {}