PEP8: fix E265: block comment should start with '# '
[amitay/samba.git] / source4 / dsdb / tests / python / dirsync.py
index ae36a5157c7cba3acdad76f1e22b36b41c7168db..0f49fd7e6304de6208cde39056f1e3568f3e99a5 100755 (executable)
@@ -64,7 +64,7 @@ if not "://" in host:
 else:
     ldaphost = host
     start = host.rindex("://")
-    host = host.lstrip(start+3)
+    host = host.lstrip(start + 3)
 
 lp = sambaopts.get_loadparm()
 creds = credopts.get_credentials(lp)
@@ -83,7 +83,7 @@ class DirsyncBaseTests(samba.tests.TestCase):
         self.user_pass = samba.generate_random_password(12, 16)
         self.configuration_dn = self.ldb_admin.get_config_basedn().get_linearized()
         self.sd_utils = sd_utils.SDUtils(self.ldb_admin)
-        #used for anonymous login
+        # used for anonymous login
         print("baseDN: %s" % self.base_dn)
 
     def get_user_dn(self, name):
@@ -98,12 +98,12 @@ class DirsyncBaseTests(samba.tests.TestCase):
         creds_tmp.set_workstation(creds.get_workstation())
         creds_tmp.set_gensec_features(creds_tmp.get_gensec_features()
                                       | gensec.FEATURE_SEAL)
-        creds_tmp.set_kerberos_state(DONT_USE_KERBEROS) # kinit is too expensive to use in a tight loop
+        creds_tmp.set_kerberos_state(DONT_USE_KERBEROS)  # kinit is too expensive to use in a tight loop
         ldb_target = SamDB(url=ldaphost, credentials=creds_tmp, lp=lp)
         return ldb_target
 
 
-#tests on ldap add operations
+# tests on ldap add operations
 class SimpleDirsyncTests(DirsyncBaseTests):
 
     def setUp(self):
@@ -141,7 +141,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
         except Exception:
             pass
 
-    #def test_dirsync_errors(self):
+    # def test_dirsync_errors(self):
 
     def test_dirsync_supported(self):
         """Test the basic of the dirsync is supported"""
@@ -295,7 +295,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
                                     attrs=["parentGUID"],
                                     controls=["dirsync:1:0:1"])
         self.assertEqual(len(res.msgs), 0)
-        ouname="OU=testou,%s" % self.base_dn
+        ouname = "OU=testou,%s" % self.base_dn
         self.ouname = ouname
         self.ldb_admin.create_ou(ouname)
         delta = Message()
@@ -399,7 +399,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
         control2 = str(":".join(ctl))
 
         # Let's create an OU
-        ouname="OU=testou2,%s" % self.base_dn
+        ouname = "OU=testou2,%s" % self.base_dn
         self.ouname = ouname
         self.ldb_admin.create_ou(ouname)
         res = self.ldb_admin.search(self.base_dn,
@@ -545,7 +545,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
     def test_dirsync_deleted_items(self):
         """Check that dirsync returnd deleted objects too"""
         # Let's create an OU
-        ouname="OU=testou3,%s" % self.base_dn
+        ouname = "OU=testou3,%s" % self.base_dn
         self.ouname = ouname
         self.ldb_admin.create_ou(ouname)
         res = self.ldb_admin.search(self.base_dn,
@@ -554,7 +554,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
         guid = None
         for e in res:
             if str(e["name"]) == "testou3":
-                guid = str(ndr_unpack(misc.GUID,e.get("objectGUID")[0]))
+                guid = str(ndr_unpack(misc.GUID, e.get("objectGUID")[0]))
 
         ctl = str(res.controls[0]).split(":")
         ctl[1] = "1"
@@ -570,7 +570,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
                                     expression="(objectClass=organizationalUnit)",
                                     controls=[control1])
         self.assertEqual(len(res), 1)
-        guid2 = str(ndr_unpack(misc.GUID,res[0].get("objectGUID")[0]))
+        guid2 = str(ndr_unpack(misc.GUID, res[0].get("objectGUID")[0]))
         self.assertEqual(guid2, guid)
         self.assertTrue(res[0].get("isDeleted"))
         self.assertTrue(res[0].get("name") != None)
@@ -582,7 +582,7 @@ class SimpleDirsyncTests(DirsyncBaseTests):
         ctl = str(res.controls[0]).split(":")
         cookie = ndr_unpack(drsblobs.ldapControlDirSyncCookie, base64.b64decode(str(ctl[4])))
         cookie.blob.guid1 = misc.GUID("128a99bf-abcd-1234-abcd-1fb625e530db")
-        controls=["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
+        controls = ["dirsync:1:0:0:%s" % base64.b64encode(ndr_pack(cookie)).decode('utf8')]
         res = self.ldb_admin.search(self.base_dn,
                                     expression="(&(objectClass=organizationalUnit)(!(isDeleted=*)))",
                                     controls=controls)
@@ -662,7 +662,7 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
         """Check that dirsync returnd deleted objects too"""
         # Let's create an OU
         self.ldb_simple = self.get_ldb_connection(self.simple_user, self.user_pass)
-        ouname="OU=testou3,%s" % self.base_dn
+        ouname = "OU=testou3,%s" % self.base_dn
         self.ouname = ouname
         self.ldb_admin.create_ou(ouname)
 
@@ -674,7 +674,7 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
         guid = None
         for e in res:
             if str(e["name"]) == "testou3":
-                guid = str(ndr_unpack(misc.GUID,e.get("objectGUID")[0]))
+                guid = str(ndr_unpack(misc.GUID, e.get("objectGUID")[0]))
 
         self.assertTrue(guid != None)
         ctl = str(res.controls[0]).split(":")
@@ -692,7 +692,7 @@ class ExtendedDirsyncTests(SimpleDirsyncTests):
                                      expression="(objectClass=organizationalUnit)",
                                      controls=[control1])
         self.assertEqual(len(res), 1)
-        guid2 = str(ndr_unpack(misc.GUID,res[0].get("objectGUID")[0]))
+        guid2 = str(ndr_unpack(misc.GUID, res[0].get("objectGUID")[0]))
         self.assertEqual(guid2, guid)
         self.assertEqual(str(res[0].dn), "")