tests/py/rodc_rwdc: Fix py2/py3 .next compat issues
authorNoel Power <noel.power@suse.com>
Thu, 1 Nov 2018 12:53:01 +0000 (12:53 +0000)
committerDouglas Bagnall <dbagnall@samba.org>
Fri, 2 Nov 2018 05:56:24 +0000 (06:56 +0100)
Python 3 does not have .next(), which we rely on, change the
code slightly so it works in py2/py3 (using builtin next function)

Pair-programmed-with: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Douglas Bagnall <dbagnall@samba.org>
Autobuild-Date(master): Fri Nov  2 06:56:24 CET 2018 on sn-devel-144

source4/dsdb/tests/python/rodc_rwdc.py

index cc715e6e7adf68db61ed85d3f2da9139fd0d3dbf..7a2e3b4e6fa13054bc79dd3dcd1d0d5c2db3e680 100644 (file)
@@ -115,7 +115,6 @@ def get_server_ref_from_samdb(samdb):
 
 
 class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase):
-    counter = itertools.count(1).next
 
     def _check_account_initial(self, dn):
         self.force_replication()
@@ -686,7 +685,7 @@ class RodcRwdcCachedTests(password_lockout_base.BasePasswordTestCase):
 
 
 class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
-    counter = itertools.count(1).next
+    counter = itertools.count(1, 1)
 
     def force_replication(self, base=None):
         if base is None:
@@ -982,7 +981,7 @@ class RodcRwdcTests(password_lockout_base.BasePasswordTestCase):
         self._test_add_modify_delete()
 
     def _new_user(self):
-        username = "u%sX%s" % (self.tag[:12], self.counter())
+        username = "u%sX%s" % (self.tag[:12], next(self.counter))
         password = 'password#1'
         dn = 'CN=%s,CN=Users,%s' % (username, self.base_dn)
         o = {