The branch, master has been updated via 4a63ab9 s4/selftest/tests: Enabled samba.tests.samba_tool.computer via 2200b22 s4/dsdb/tests: port samba4.tombstone_reanimation for PY3 via 59ff17c s3/selftst: enable samba4.tombstone_reanimation for py3 via d18c9dc s4/selftest: enable samba4.drs.replica_sync_rodc.python for py3 via 2b4d281 s4/torture/drs: PY3 port for samba4.drs.replica_sync_rodc via 7b4db74 s4/selftest: enable samba.tests.dsdb_schema_attributes for py3 via e5afa01 python/samba/tests: port samba.tests.dsdb_schema_attributes to PY3 from 8c2c979 PEP8: fix E128: continuation line under-indented for visual indent
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4a63ab95ca4240cdb808c189c29b5b3809270041 Author: Noel Power <noel.po...@suse.com> Date: Thu Apr 26 18:23:50 2018 +0100 s4/selftest/tests: Enabled samba.tests.samba_tool.computer Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org Autobuild-User(master): Noel Power <npo...@samba.org> Autobuild-Date(master): Thu Sep 6 19:24:54 CEST 2018 on sn-devel-144 commit 2200b22b345213539d49d374731cf076a8ce4a70 Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 3 18:47:20 2018 +0100 s4/dsdb/tests: port samba4.tombstone_reanimation for PY3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org commit 59ff17cc75b675d22b2e46e25da125b83f274c26 Author: Noel Power <noel.po...@suse.com> Date: Thu May 10 18:17:29 2018 +0100 s3/selftst: enable samba4.tombstone_reanimation for py3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org commit d18c9dc61cb0c78ce2a0dc72c716fa75fd1ab119 Author: Noel Power <noel.po...@suse.com> Date: Thu May 10 17:19:47 2018 +0100 s4/selftest: enable samba4.drs.replica_sync_rodc.python for py3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org commit 2b4d2810eb8017866816069d37fd2f48790e8055 Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 3 17:56:56 2018 +0100 s4/torture/drs: PY3 port for samba4.drs.replica_sync_rodc Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org commit 7b4db7464222378642dd61a66e80d5f168119ee3 Author: Noel Power <noel.po...@suse.com> Date: Thu May 10 16:35:29 2018 +0100 s4/selftest: enable samba.tests.dsdb_schema_attributes for py3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org commit e5afa011fd7d5000f5b25ce31478c751e8144f6d Author: Noel Power <noel.po...@suse.com> Date: Mon Sep 3 17:34:27 2018 +0100 python/samba/tests: port samba.tests.dsdb_schema_attributes to PY3 Signed-off-by: Noel Power <noel.po...@suse.com> Reviewed-by: Andrew Bartlett abart...@samba.org ----------------------------------------------------------------------- Summary of changes: python/samba/drs_utils.py | 2 +- python/samba/tests/dsdb_schema_attributes.py | 12 ++++++------ source4/dsdb/tests/python/tombstone_reanimation.py | 18 +++++++++++++----- source4/selftest/tests.py | 9 +++++---- source4/torture/drs/python/replica_sync_rodc.py | 3 ++- 5 files changed, 27 insertions(+), 17 deletions(-) Changeset truncated at 500 lines: diff --git a/python/samba/drs_utils.py b/python/samba/drs_utils.py index 7573b62..05a9df7 100644 --- a/python/samba/drs_utils.py +++ b/python/samba/drs_utils.py @@ -168,7 +168,7 @@ def drs_get_rodc_partial_attribute_set(samdb): "searchFlags"]) for r in res: - ldap_display_name = r["lDAPDisplayName"][0] + ldap_display_name = str(r["lDAPDisplayName"][0]) if "systemFlags" in r: system_flags = r["systemFlags"][0] if (int(system_flags) & (samba.dsdb.DS_FLAG_ATTR_NOT_REPLICATED | diff --git a/python/samba/tests/dsdb_schema_attributes.py b/python/samba/tests/dsdb_schema_attributes.py index b13712c..d27cc07 100644 --- a/python/samba/tests/dsdb_schema_attributes.py +++ b/python/samba/tests/dsdb_schema_attributes.py @@ -104,7 +104,7 @@ systemOnly: FALSE self.assertIn(attr_ldap_name, attr_res[0]) self.assertEquals(len(attr_res[0][attr_ldap_name]), 1) - self.assertEquals(attr_res[0][attr_ldap_name][0], "CASE_INSENSITIVE") + self.assertEquals(str(attr_res[0][attr_ldap_name][0]), "CASE_INSENSITIVE") # Check @INDEXLIST @@ -127,7 +127,7 @@ systemOnly: FALSE self.assertIn(attr_ldap_name, attr_res[0]) self.assertEquals(len(attr_res[0][attr_ldap_name]), 1) - self.assertEquals(attr_res[0][attr_ldap_name][0], "CASE_INSENSITIVE") + self.assertEquals(str(attr_res[0][attr_ldap_name][0]), "CASE_INSENSITIVE") # Check @INDEXLIST @@ -160,11 +160,11 @@ systemOnly: FALSE self.assertIn(attr_ldap_name, attr_res[0]) self.assertEquals(len(attr_res[0][attr_ldap_name]), 1) - self.assertEquals(attr_res[0][attr_ldap_name][0], "CASE_INSENSITIVE") + self.assertEquals(str(attr_res[0][attr_ldap_name][0]), "CASE_INSENSITIVE") self.assertIn(attr_ldap_name2, attr_res[0]) self.assertEquals(len(attr_res[0][attr_ldap_name2]), 1) - self.assertEquals(attr_res[0][attr_ldap_name2][0], "CASE_INSENSITIVE") + self.assertEquals(str(attr_res[0][attr_ldap_name2][0]), "CASE_INSENSITIVE") # Check @INDEXLIST @@ -188,7 +188,7 @@ systemOnly: FALSE self.assertEquals(len(res[0]), 1) self.assertTrue("@TEST_EXTRA" in res[0]) self.assertEquals(len(res[0]["@TEST_EXTRA"]), 1) - self.assertEquals(res[0]["@TEST_EXTRA"][0], "HIDDEN") + self.assertEquals(str(res[0]["@TEST_EXTRA"][0]), "HIDDEN") samdb2 = samba.tests.connect_samdb(self.lp.samdb_url()) @@ -222,7 +222,7 @@ systemOnly: FALSE self.assertEquals(len(res[0]), 1) self.assertTrue("@TEST_EXTRA" in res[0]) self.assertEquals(len(res[0]["@TEST_EXTRA"]), 1) - self.assertEquals(res[0]["@TEST_EXTRA"][0], "1") + self.assertEquals(str(res[0]["@TEST_EXTRA"][0]), "1") samdb2 = samba.tests.connect_samdb(self.lp.samdb_url()) diff --git a/source4/dsdb/tests/python/tombstone_reanimation.py b/source4/dsdb/tests/python/tombstone_reanimation.py index c82cb4c..2e0f370 100755 --- a/source4/dsdb/tests/python/tombstone_reanimation.py +++ b/source4/dsdb/tests/python/tombstone_reanimation.py @@ -31,6 +31,7 @@ from samba.dcerpc import security from samba.dcerpc import drsblobs from samba.dcerpc.drsuapi import * from samba.tests.password_test import PasswordCommon +from samba.compat import get_string import samba.tests from ldb import (SCOPE_BASE, FLAG_MOD_ADD, FLAG_MOD_DELETE, FLAG_MOD_REPLACE, Dn, Message, @@ -58,7 +59,7 @@ class RestoredObjectAttributesBaseTestCase(samba.tests.TestCase): super(RestoredObjectAttributesBaseTestCase, self).tearDown() def GUID_string(self, guid): - return self.samdb.schema_format_value("objectGUID", guid) + return get_string(self.samdb.schema_format_value("objectGUID", guid)) def search_guid(self, guid, attrs=["*"]): res = self.samdb.search(base="<GUID=%s>" % self.GUID_string(guid), @@ -129,12 +130,19 @@ class RestoredObjectAttributesBaseTestCase(samba.tests.TestCase): if expected_val == "**": # "**" values means "any" continue - self.assertEqual(expected_val, str(actual_val), + # if expected_val is e.g. ldb.bytes we can't depend on + # str(actual_value) working, we may just get a decoding + # error. Better to just compare raw values + if not isinstance(expected_val, str): + actual_val = actual_val[0] + else: + actual_val = str(actual_val) + self.assertEqual(expected_val, actual_val, "Unexpected value (%s) for '%s', expected (%s)" % ( - str(actual_val), name, expected_val)) + repr(actual_val), name, repr(expected_val))) def _check_metadata(self, metadata, expected): - repl = ndr_unpack(drsblobs.replPropertyMetaDataBlob, str(metadata[0])) + repl = ndr_unpack(drsblobs.replPropertyMetaDataBlob, metadata[0]) repl_array = [] for o in repl.ctr.array: @@ -261,7 +269,7 @@ class BaseRestoreObjectTestCase(RestoredObjectAttributesBaseTestCase): objDeleted1 = self.search_guid(guid1) self.restore_deleted_object(self.samdb, objDeleted1.dn, usr1, {"url": "www.samba.org"}) objLive2 = self.search_dn(usr1) - self.assertEqual(objLive2["url"][0], "www.samba.org") + self.assertEqual(str(objLive2["url"][0]), "www.samba.org") samba.tests.delete_force(self.samdb, usr1) def test_undelete_newuser(self): diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py index df9b7fa..83efeab 100755 --- a/source4/selftest/tests.py +++ b/source4/selftest/tests.py @@ -642,7 +642,7 @@ planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.user_virtualCryptSHA" planpythontestsuite("chgdcpass:local", "samba.tests.samba_tool.user_check_password_script", py3_compatible=True) planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.group", py3_compatible=True) planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.ou", py3_compatible=True) -planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.computer") +planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.computer", py3_compatible=True) planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.forest") planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.samba_tool.schema") planpythontestsuite("ad_dc:local", "samba.tests.samba_tool.ntacl", py3_compatible=True) @@ -827,7 +827,7 @@ planoldpythontestsuite("ad_dc_ntvfs", "dsdb_schema_info", name="samba4.schemaInfo.python(ad_dc_ntvfs)", extra_args=['-U"$DOMAIN/$DC_USERNAME%$DC_PASSWORD"'], py3_compatible=True) -planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb_schema_attributes") +planpythontestsuite("ad_dc_ntvfs:local", "samba.tests.dsdb_schema_attributes", py3_compatible=True) plantestsuite_loadlist("samba4.urgent_replication.python(ad_dc_ntvfs)", "ad_dc_ntvfs:local", [python, os.path.join(samba4srcdir, "dsdb/tests/python/urgent_replication.py"), '$PREFIX_ABS/ad_dc_ntvfs/private/sam.ldb', '$LOADLIST', '$LISTOPT']) plantestsuite_loadlist("samba4.ldap.dirsync.python(ad_dc_ntvfs)", "ad_dc_ntvfs", [python, os.path.join(samba4srcdir, "dsdb/tests/python/dirsync.py"), '$SERVER', '-U"$USERNAME%$PASSWORD"', '--workgroup=$DOMAIN', '$LOADLIST', '$LISTOPT']) @@ -867,7 +867,8 @@ planoldpythontestsuite("rodc:local", "replica_sync_rodc", extra_path=[os.path.join(samba4srcdir, 'torture/drs/python')], name="samba4.drs.replica_sync_rodc.python(rodc)", environ={'DC1': '$DC_SERVER', 'DC2': '$RODC_DC_SERVER'}, - extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD']) + extra_args=['-U$DOMAIN/$DC_USERNAME%$DC_PASSWORD'], + py3_compatible=True) planoldpythontestsuite("ad_dc_ntvfs", "password_settings", extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')], @@ -896,7 +897,7 @@ for env in ["ad_dc_ntvfs"]: planoldpythontestsuite(env, "tombstone_reanimation", name="samba4.tombstone_reanimation.python", environ={'TEST_SERVER': '$SERVER', 'TEST_USERNAME': '$USERNAME', 'TEST_PASSWORD': '$PASSWORD'}, - extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')] + extra_path=[os.path.join(samba4srcdir, 'dsdb/tests/python')], py3_compatible=True ) # this is a basic sanity-check of Kerberos/NTLM user login diff --git a/source4/torture/drs/python/replica_sync_rodc.py b/source4/torture/drs/python/replica_sync_rodc.py index 1e02610..f439e73 100644 --- a/source4/torture/drs/python/replica_sync_rodc.py +++ b/source4/torture/drs/python/replica_sync_rodc.py @@ -32,6 +32,7 @@ import drs_base import samba.tests import time import ldb +from samba.compat import get_string from ldb import ( SCOPE_BASE, LdbError, ERR_NO_SUCH_OBJECT) @@ -62,7 +63,7 @@ objectClass: organizationalUnit samdb.add_ldif(ldif) res = samdb.search(base="%s,%s" % (name, self.domain_dn), scope=SCOPE_BASE, attrs=["objectGUID"]) - return self._GUID_string(res[0]["objectGUID"][0]) + return get_string(self._GUID_string(res[0]["objectGUID"][0])) def _check_deleted(self, sam_ldb, guid): # search the user by guid as it may be deleted -- Samba Shared Repository