diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2012-09-27 09:30:47 -0700 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2012-09-27 18:45:12 +0200 |
commit | 2a797f29aa12f6847844af504026be52db659fbb (patch) | |
tree | 8d3e4a6e2003239c5b69efd578c9452e0bc9b86d /source4/scripting/python/samba/tests | |
parent | 6986f7bdda56d693c642945485006f9660053758 (diff) | |
download | samba-2a797f29aa12f6847844af504026be52db659fbb.tar.gz samba-2a797f29aa12f6847844af504026be52db659fbb.tar.bz2 samba-2a797f29aa12f6847844af504026be52db659fbb.zip |
s4-python: Various formatting fixes.
* Trailing whitespace
* use of "==" where "is" should be used
* double spaces
Diffstat (limited to 'source4/scripting/python/samba/tests')
-rw-r--r-- | source4/scripting/python/samba/tests/auth.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/core.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/credentials.py | 6 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dcerpc/bare.py | 12 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dcerpc/registry.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dcerpc/unix.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/dns.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/gensec.py | 8 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/provision.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/samba3.py | 4 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/samba3sam.py | 132 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/samba_tool/ntacl.py | 8 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/samdb.py | 10 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/upgradeprovision.py | 2 | ||||
-rw-r--r-- | source4/scripting/python/samba/tests/xattr.py | 2 |
15 files changed, 101 insertions, 101 deletions
diff --git a/source4/scripting/python/samba/tests/auth.py b/source4/scripting/python/samba/tests/auth.py index 9894ba83ec..f71e1a784d 100644 --- a/source4/scripting/python/samba/tests/auth.py +++ b/source4/scripting/python/samba/tests/auth.py @@ -15,9 +15,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -"""Tests for the Auth Python bindings. +"""Tests for the Auth Python bindings. -Note that this just tests the bindings work. It does not intend to test +Note that this just tests the bindings work. It does not intend to test the functionality, that's already done in other tests. """ diff --git a/source4/scripting/python/samba/tests/core.py b/source4/scripting/python/samba/tests/core.py index dbde83261a..8206e68d4f 100644 --- a/source4/scripting/python/samba/tests/core.py +++ b/source4/scripting/python/samba/tests/core.py @@ -36,11 +36,11 @@ class SubstituteVarTestCase(TestCase): samba.substitute_var("foo ${bar}", {"bar": "bla"})) def test_broken(self): - self.assertEquals("foo ${bdkjfhsdkfh sdkfh ", + self.assertEquals("foo ${bdkjfhsdkfh sdkfh ", samba.substitute_var("foo ${bdkjfhsdkfh sdkfh ", {"bar": "bla"})) def test_unknown_var(self): - self.assertEquals("foo ${bla} gsff", + self.assertEquals("foo ${bla} gsff", samba.substitute_var("foo ${bla} gsff", {"bar": "bla"})) def test_check_all_substituted(self): diff --git a/source4/scripting/python/samba/tests/credentials.py b/source4/scripting/python/samba/tests/credentials.py index c8aed92928..95ee0fa0de 100644 --- a/source4/scripting/python/samba/tests/credentials.py +++ b/source4/scripting/python/samba/tests/credentials.py @@ -15,9 +15,9 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -"""Tests for the Credentials Python bindings. +"""Tests for the Credentials Python bindings. -Note that this just tests the bindings work. It does not intend to test +Note that this just tests the bindings work. It does not intend to test the functionality, that's already done in other tests. """ @@ -78,7 +78,7 @@ class CredentialsTests(samba.tests.TestCase): def test_get_nt_hash(self): self.creds.set_password("geheim") - self.assertEquals('\xc2\xae\x1f\xe6\xe6H\x84cRE>\x81o*\xeb\x93', + self.assertEquals('\xc2\xae\x1f\xe6\xe6H\x84cRE>\x81o*\xeb\x93', self.creds.get_nt_hash()) def test_guess(self): diff --git a/source4/scripting/python/samba/tests/dcerpc/bare.py b/source4/scripting/python/samba/tests/dcerpc/bare.py index 04d470eb39..3efbf9d4cf 100644 --- a/source4/scripting/python/samba/tests/dcerpc/bare.py +++ b/source4/scripting/python/samba/tests/dcerpc/bare.py @@ -26,26 +26,26 @@ class BareTestCase(samba.tests.TestCase): def test_bare(self): # Connect to the echo pipe - x = ClientConnection("ncalrpc:localhost[DEFAULT]", + x = ClientConnection("ncalrpc:localhost[DEFAULT]", ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=samba.tests.env_loadparm()) self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4)) def test_alter_context(self): - x = ClientConnection("ncalrpc:localhost[DEFAULT]", + x = ClientConnection("ncalrpc:localhost[DEFAULT]", ("12345778-1234-abcd-ef00-0123456789ac", 1), lp_ctx=samba.tests.env_loadparm()) - y = ClientConnection("ncalrpc:localhost", + y = ClientConnection("ncalrpc:localhost", ("60a15ec5-4de8-11d7-a637-005056a20182", 1), basis_connection=x, lp_ctx=samba.tests.env_loadparm()) x.alter_context(("60a15ec5-4de8-11d7-a637-005056a20182", 1)) # FIXME: self.assertEquals("\x01\x00\x00\x00", x.request(0, chr(0) * 4)) def test_two_connections(self): - x = ClientConnection("ncalrpc:localhost[DEFAULT]", - ("60a15ec5-4de8-11d7-a637-005056a20182", 1), + x = ClientConnection("ncalrpc:localhost[DEFAULT]", + ("60a15ec5-4de8-11d7-a637-005056a20182", 1), lp_ctx=samba.tests.env_loadparm()) - y = ClientConnection("ncalrpc:localhost", + y = ClientConnection("ncalrpc:localhost", ("60a15ec5-4de8-11d7-a637-005056a20182", 1), basis_connection=x, lp_ctx=samba.tests.env_loadparm()) self.assertEquals("\x01\x00\x00\x00", y.request(0, chr(0) * 4)) diff --git a/source4/scripting/python/samba/tests/dcerpc/registry.py b/source4/scripting/python/samba/tests/dcerpc/registry.py index b707437763..c7bcbfd530 100644 --- a/source4/scripting/python/samba/tests/dcerpc/registry.py +++ b/source4/scripting/python/samba/tests/dcerpc/registry.py @@ -44,7 +44,7 @@ class WinregTests(RpcInterfaceTestCase): self.conn.CloseKey(handle) def test_getkeyinfo(self): - handle = self.conn.OpenHKLM(None, + handle = self.conn.OpenHKLM(None, winreg.KEY_QUERY_VALUE | winreg.KEY_ENUMERATE_SUB_KEYS) x = self.conn.QueryInfoKey(handle, winreg.String()) self.assertEquals(9, len(x)) # should return a 9-tuple diff --git a/source4/scripting/python/samba/tests/dcerpc/unix.py b/source4/scripting/python/samba/tests/dcerpc/unix.py index 20fbf999fa..e8ef4da863 100644 --- a/source4/scripting/python/samba/tests/dcerpc/unix.py +++ b/source4/scripting/python/samba/tests/dcerpc/unix.py @@ -44,6 +44,6 @@ class UnixinfoTests(RpcInterfaceTestCase): def test_uidtosid(self): self.conn.UidToSid(1000) - + def test_uidtosid_fail(self): self.assertRaises(TypeError, self.conn.UidToSid, "100") diff --git a/source4/scripting/python/samba/tests/dns.py b/source4/scripting/python/samba/tests/dns.py index 327e166314..7401124e2d 100644 --- a/source4/scripting/python/samba/tests/dns.py +++ b/source4/scripting/python/samba/tests/dns.py @@ -47,13 +47,13 @@ class DNSTest(TestCase): def assert_dns_rcode_equals(self, packet, rcode): "Helper function to check return code" p_errcode = packet.operation & 0x000F - self.assertEquals(p_errcode, rcode, "Expected RCODE %s, got %s" % \ + self.assertEquals(p_errcode, rcode, "Expected RCODE %s, got %s" % (self.errstr(rcode), self.errstr(p_errcode))) def assert_dns_opcode_equals(self, packet, opcode): "Helper function to check opcode" p_opcode = packet.operation & 0x7800 - self.assertEquals(p_opcode, opcode, "Expected OPCODE %s, got %s" % \ + self.assertEquals(p_opcode, opcode, "Expected OPCODE %s, got %s" % (opcode, p_opcode)) def make_name_packet(self, opcode, qid=None): diff --git a/source4/scripting/python/samba/tests/gensec.py b/source4/scripting/python/samba/tests/gensec.py index 712f177cfc..e270c418ea 100644 --- a/source4/scripting/python/samba/tests/gensec.py +++ b/source4/scripting/python/samba/tests/gensec.py @@ -17,7 +17,7 @@ """Tests for GENSEC. -Note that this just tests the bindings work. It does not intend to test +Note that this just tests the bindings work. It does not intend to test the functionality, that's already done in other tests. """ @@ -54,7 +54,7 @@ class GensecTests(samba.tests.TestCase): self.gensec_client.want_feature(gensec.FEATURE_SEAL) self.gensec_client.start_mech_by_sasl_name("GSSAPI") - self.gensec_server = gensec.Security.start_server(settings=self.settings, + self.gensec_server = gensec.Security.start_server(settings=self.settings, auth_context=auth.AuthContext(lp_ctx=self.lp_ctx)) creds = Credentials() creds.guess(self.lp_ctx) @@ -69,7 +69,7 @@ class GensecTests(samba.tests.TestCase): server_to_client = "" """Run the actual call loop""" - while client_finished == False and server_finished == False: + while not client_finished and not server_finished: if not client_finished: print "running client gensec_update" (client_finished, client_to_server) = self.gensec_client.update(server_to_client) @@ -118,7 +118,7 @@ class GensecTests(samba.tests.TestCase): """Run the actual call loop""" i = 0 - while client_finished == False or server_finished == False: + while not client_finished or not server_finished: i += 1 if not client_finished: print "running client gensec_update: %d: %r" % (len(server_to_client), server_to_client) diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py index 408c9883f3..f7fb4079df 100644 --- a/source4/scripting/python/samba/tests/provision.py +++ b/source4/scripting/python/samba/tests/provision.py @@ -126,7 +126,7 @@ class Disabled(object): class SanitizeServerRoleTests(TestCase): def test_same(self): - self.assertEquals("standalone server", + self.assertEquals("standalone server", sanitize_server_role("standalone server")) self.assertEquals("member server", sanitize_server_role("member server")) diff --git a/source4/scripting/python/samba/tests/samba3.py b/source4/scripting/python/samba/tests/samba3.py index d83db0f8b2..0a7f13c66f 100644 --- a/source4/scripting/python/samba/tests/samba3.py +++ b/source4/scripting/python/samba/tests/samba3.py @@ -55,8 +55,8 @@ class RegistryTestCase(TestCase): self.assertEquals(["SOFTWARE", "SYSTEM"], self.registry.subkeys("HKLM")) def test_values(self): - self.assertEquals({'DisplayName': (1L, 'E\x00v\x00e\x00n\x00t\x00 \x00L\x00o\x00g\x00\x00\x00'), - 'ErrorControl': (4L, '\x01\x00\x00\x00')}, + self.assertEquals({'DisplayName': (1L, 'E\x00v\x00e\x00n\x00t\x00 \x00L\x00o\x00g\x00\x00\x00'), + 'ErrorControl': (4L, '\x01\x00\x00\x00')}, self.registry.values("HKLM/SYSTEM/CURRENTCONTROLSET/SERVICES/EVENTLOG")) diff --git a/source4/scripting/python/samba/tests/samba3sam.py b/source4/scripting/python/samba/tests/samba3sam.py index e4634722be..9c017fb79c 100644 --- a/source4/scripting/python/samba/tests/samba3sam.py +++ b/source4/scripting/python/samba/tests/samba3sam.py @@ -56,7 +56,7 @@ class MapBaseTestCase(TestCaseInTempDir): "@LIST": "rootdse,paged_results,server_sort,asq,samldb,password_hash,operational,objectguid,rdn_name,samba3sam,samba3sid,show_deleted,partition"}) ldb.add({"dn": "@PARTITION", - "partition": ["%s" % (s4.basedn_casefold), + "partition": ["%s" % (s4.basedn_casefold), "%s" % (s3.basedn_casefold)], "replicateEntries": ["@ATTRIBUTES", "@INDEXLIST"], "modules": "*:"}) @@ -79,7 +79,7 @@ class MapBaseTestCase(TestCaseInTempDir): tempdir = self.tempdir class Target: - """Simple helper class that contains data for a specific SAM + """Simple helper class that contains data for a specific SAM connection.""" def __init__(self, basedn, dn, lp): @@ -169,9 +169,9 @@ class Samba3SamTestCase(MapBaseTestCase): """Looking up mapped entry containing SID""" msg = self.ldb.search(expression="(cn=Replicator)") self.assertEquals(len(msg), 1) - self.assertEquals(str(msg[0].dn), + self.assertEquals(str(msg[0].dn), "cn=Replicator,ou=Groups,dc=vernstok,dc=nl") - self.assertTrue("objectSid" in msg[0]) + self.assertTrue("objectSid" in msg[0]) self.assertSidEquals("S-1-5-21-4231626423-2410014848-2360679739-552", msg[0]["objectSid"]) oc = set(msg[0]["objectClass"]) @@ -180,28 +180,28 @@ class Samba3SamTestCase(MapBaseTestCase): def test_search_by_objclass(self): """Looking up by objectClass""" msg = self.ldb.search(expression="(|(objectClass=user)(cn=Administrator))") - self.assertEquals(set([str(m.dn) for m in msg]), - set(["unixName=Administrator,ou=Users,dc=vernstok,dc=nl", + self.assertEquals(set([str(m.dn) for m in msg]), + set(["unixName=Administrator,ou=Users,dc=vernstok,dc=nl", "unixName=nobody,ou=Users,dc=vernstok,dc=nl"])) def test_s3sam_modify(self): # Adding a record that will be fallbacked - self.ldb.add({"dn": "cn=Foo", - "foo": "bar", - "blah": "Blie", - "cn": "Foo", + self.ldb.add({"dn": "cn=Foo", + "foo": "bar", + "blah": "Blie", + "cn": "Foo", "showInAdvancedViewOnly": "TRUE"} ) # Checking for existence of record (local) - # TODO: This record must be searched in the local database, which is + # TODO: This record must be searched in the local database, which is # currently only supported for base searches # msg = ldb.search(expression="(cn=Foo)", ['foo','blah','cn','showInAdvancedViewOnly')] # TODO: Actually, this version should work as well but doesn't... - # - # - msg = self.ldb.search(expression="(cn=Foo)", base="cn=Foo", - scope=SCOPE_BASE, + # + # + msg = self.ldb.search(expression="(cn=Foo)", base="cn=Foo", + scope=SCOPE_BASE, attrs=['foo','blah','cn','showInAdvancedViewOnly']) self.assertEquals(len(msg), 1) self.assertEquals(str(msg[0]["showInAdvancedViewOnly"]), "TRUE") @@ -216,14 +216,14 @@ class Samba3SamTestCase(MapBaseTestCase): "cn": "Niemand"}) # Checking for existence of record (remote) - msg = self.ldb.search(expression="(unixName=bin)", + msg = self.ldb.search(expression="(unixName=bin)", attrs=['unixName','cn','dn', 'sambaUnicodePwd']) self.assertEquals(len(msg), 1) self.assertEquals(str(msg[0]["cn"]), "Niemand") self.assertEquals(str(msg[0]["sambaUnicodePwd"]), "geheim") # Checking for existence of record (local && remote) - msg = self.ldb.search(expression="(&(unixName=bin)(sambaUnicodePwd=geheim))", + msg = self.ldb.search(expression="(&(unixName=bin)(sambaUnicodePwd=geheim))", attrs=['unixName','cn','dn', 'sambaUnicodePwd']) self.assertEquals(len(msg), 1) # TODO: should check with more records self.assertEquals(str(msg[0]["cn"]), "Niemand") @@ -231,7 +231,7 @@ class Samba3SamTestCase(MapBaseTestCase): self.assertEquals(str(msg[0]["sambaUnicodePwd"]), "geheim") # Checking for existence of record (local || remote) - msg = self.ldb.search(expression="(|(unixName=bin)(sambaUnicodePwd=geheim))", + msg = self.ldb.search(expression="(|(unixName=bin)(sambaUnicodePwd=geheim))", attrs=['unixName','cn','dn', 'sambaUnicodePwd']) #print "got %d replies" % len(msg) self.assertEquals(len(msg), 1) # TODO: should check with more records @@ -242,7 +242,7 @@ class Samba3SamTestCase(MapBaseTestCase): # Checking for data in destination database msg = self.samba3.db.search(expression="(cn=Niemand)") self.assertTrue(len(msg) >= 1) - self.assertEquals(str(msg[0]["sambaSID"]), + self.assertEquals(str(msg[0]["sambaSID"]), "S-1-5-21-4231626423-2410014848-2360679739-2001") self.assertEquals(str(msg[0]["displayName"]), "Niemand") @@ -286,13 +286,13 @@ delete: description self.assertTrue(not "description" in msg[0]) # Renaming record... - self.ldb.rename("cn=Niemand,cn=Users,dc=vernstok,dc=nl", + self.ldb.rename("cn=Niemand,cn=Users,dc=vernstok,dc=nl", "cn=Niemand2,cn=Users,dc=vernstok,dc=nl") # Checking whether DN has changed... msg = self.ldb.search(expression="(cn=Niemand2)") self.assertEquals(len(msg), 1) - self.assertEquals(str(msg[0].dn), + self.assertEquals(str(msg[0].dn), "cn=Niemand2,cn=Users,dc=vernstok,dc=nl") # Deleting record... @@ -377,7 +377,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 "objectClass": "posixAccount", "cn": "A", "sambaNextRid": "x", - "sambaBadPasswordCount": "x", + "sambaBadPasswordCount": "x", "sambaLogonTime": "x", "description": "x", "sambaSID": "S-1-5-21-4231626423-2410014848-2360679739-552", @@ -405,7 +405,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Search remote record by local DN dn = self.samba4.dn("cn=A") - res = self.ldb.search(dn, scope=SCOPE_BASE, + res = self.ldb.search(dn, scope=SCOPE_BASE, attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) @@ -414,7 +414,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Search remote record by remote DN dn = self.samba3.dn("cn=A") - res = self.samba3.db.search(dn, scope=SCOPE_BASE, + res = self.samba3.db.search(dn, scope=SCOPE_BASE, attrs=["dnsHostName", "lastLogon", "sambaLogonTime"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) @@ -424,7 +424,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Search split record by local DN dn = self.samba4.dn("cn=X") - res = self.ldb.search(dn, scope=SCOPE_BASE, + res = self.ldb.search(dn, scope=SCOPE_BASE, attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) @@ -433,7 +433,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Search split record by remote DN dn = self.samba3.dn("cn=X") - res = self.samba3.db.search(dn, scope=SCOPE_BASE, + res = self.samba3.db.search(dn, scope=SCOPE_BASE, attrs=["dnsHostName", "lastLogon", "sambaLogonTime"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) @@ -444,7 +444,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Testing search by attribute # Search by ignored attribute - res = self.ldb.search(expression="(revision=x)", scope=SCOPE_DEFAULT, + res = self.ldb.search(expression="(revision=x)", scope=SCOPE_DEFAULT, attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -456,7 +456,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[1]["lastLogon"]), "y") # Search by kept attribute - res = self.ldb.search(expression="(description=y)", + res = self.ldb.search(expression="(description=y)", scope=SCOPE_DEFAULT, attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -500,10 +500,10 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 res[0]["objectSid"]) self.assertTrue("objectSid" in res[0]) - # Search by generated attribute + # Search by generated attribute # In most cases, this even works when the mapping is missing # a `convert_operator' by enumerating the remote db. - res = self.ldb.search(expression="(primaryGroupID=512)", + res = self.ldb.search(expression="(primaryGroupID=512)", attrs=["dnsHostName", "lastLogon", "primaryGroupID"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A")) @@ -520,10 +520,10 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # print obj + ": " + res[i][obj] # } # print "---" - # + # # Search by remote name of renamed attribute */ - res = self.ldb.search(expression="(sambaBadPasswordCount=*)", + res = self.ldb.search(expression="(sambaBadPasswordCount=*)", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 0) @@ -562,7 +562,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Testing search by parse tree # Search by conjunction of local attributes - res = self.ldb.search(expression="(&(codePage=x)(revision=x))", + res = self.ldb.search(expression="(&(codePage=x)(revision=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -574,7 +574,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[1]["lastLogon"]), "y") # Search by conjunction of remote attributes - res = self.ldb.search(expression="(&(lastLogon=x)(description=x))", + res = self.ldb.search(expression="(&(lastLogon=x)(description=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -584,9 +584,9 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[1].dn), self.samba4.dn("cn=X")) self.assertEquals(str(res[1]["dnsHostName"]), "x") self.assertEquals(str(res[1]["lastLogon"]), "x") - - # Search by conjunction of local and remote attribute - res = self.ldb.search(expression="(&(codePage=x)(description=x))", + + # Search by conjunction of local and remote attribute + res = self.ldb.search(expression="(&(codePage=x)(description=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -599,15 +599,15 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 # Search by conjunction of local and remote attribute w/o match attrs = ["dnsHostName", "lastLogon"] - res = self.ldb.search(expression="(&(codePage=x)(nextRid=x))", + res = self.ldb.search(expression="(&(codePage=x)(nextRid=x))", attrs=attrs) self.assertEquals(len(res), 0) - res = self.ldb.search(expression="(&(revision=x)(lastLogon=z))", + res = self.ldb.search(expression="(&(revision=x)(lastLogon=z))", attrs=attrs) self.assertEquals(len(res), 0) # Search by disjunction of local attributes - res = self.ldb.search(expression="(|(revision=x)(dnsHostName=x))", + res = self.ldb.search(expression="(|(revision=x)(dnsHostName=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 2) res = sorted(res, key=attrgetter('dn')) @@ -619,7 +619,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[1]["lastLogon"]), "y") # Search by disjunction of remote attributes - res = self.ldb.search(expression="(|(badPwdCount=x)(lastLogon=x))", + res = self.ldb.search(expression="(|(badPwdCount=x)(lastLogon=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 3) res = sorted(res, key=attrgetter('dn')) @@ -634,7 +634,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[2]["lastLogon"]), "x") # Search by disjunction of local and remote attribute - res = self.ldb.search(expression="(|(revision=x)(lastLogon=y))", + res = self.ldb.search(expression="(|(revision=x)(lastLogon=y))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 3) res = sorted(res, key=attrgetter('dn')) @@ -649,12 +649,12 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[2]["lastLogon"]), "y") # Search by disjunction of local and remote attribute w/o match - res = self.ldb.search(expression="(|(codePage=y)(nextRid=z))", + res = self.ldb.search(expression="(|(codePage=y)(nextRid=z))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 0) # Search by negated local attribute - res = self.ldb.search(expression="(!(revision=x))", + res = self.ldb.search(expression="(!(revision=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 6) res = sorted(res, key=attrgetter('dn')) @@ -672,7 +672,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[3]["lastLogon"]), "z") # Search by negated remote attribute - res = self.ldb.search(expression="(!(description=x))", + res = self.ldb.search(expression="(!(description=x))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 4) res = sorted(res, key=attrgetter('dn')) @@ -684,7 +684,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[1]["lastLogon"]), "z") # Search by negated conjunction of local attributes - res = self.ldb.search(expression="(!(&(codePage=x)(revision=x)))", + res = self.ldb.search(expression="(!(&(codePage=x)(revision=x)))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 6) res = sorted(res, key=attrgetter('dn')) @@ -702,7 +702,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[3]["lastLogon"]), "z") # Search by negated conjunction of remote attributes - res = self.ldb.search(expression="(!(&(lastLogon=x)(description=x)))", + res = self.ldb.search(expression="(!(&(lastLogon=x)(description=x)))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 6) res = sorted(res, key=attrgetter('dn')) @@ -720,7 +720,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[3]["lastLogon"]), "z") # Search by negated conjunction of local and remote attribute - res = self.ldb.search(expression="(!(&(codePage=x)(description=x)))", + res = self.ldb.search(expression="(!(&(codePage=x)(description=x)))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 6) res = sorted(res, key=attrgetter('dn')) @@ -738,7 +738,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[3]["lastLogon"]), "z") # Search by negated disjunction of local attributes - res = self.ldb.search(expression="(!(|(revision=x)(dnsHostName=x)))", + res = self.ldb.search(expression="(!(|(revision=x)(dnsHostName=x)))", attrs=["dnsHostName", "lastLogon"]) res = sorted(res, key=attrgetter('dn')) self.assertEquals(str(res[0].dn), self.samba4.dn("cn=A")) @@ -755,7 +755,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[3]["lastLogon"]), "z") # Search by negated disjunction of remote attributes - res = self.ldb.search(expression="(!(|(badPwdCount=x)(lastLogon=x)))", + res = self.ldb.search(expression="(!(|(badPwdCount=x)(lastLogon=x)))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 5) res = sorted(res, key=attrgetter('dn')) @@ -770,7 +770,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[2]["lastLogon"]), "z") # Search by negated disjunction of local and remote attribute - res = self.ldb.search(expression="(!(|(revision=x)(lastLogon=y)))", + res = self.ldb.search(expression="(!(|(revision=x)(lastLogon=y)))", attrs=["dnsHostName", "lastLogon"]) self.assertEquals(len(res), 5) res = sorted(res, key=attrgetter('dn')) @@ -813,7 +813,7 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 """Modification of local records.""" # Add local record dn = "cn=test,dc=idealx,dc=org" - self.ldb.add({"dn": dn, + self.ldb.add({"dn": dn, "cn": "test", "foo": "bar", "revision": "1", @@ -827,11 +827,11 @@ objectSid: S-1-5-21-4231626423-2410014848-2360679739-552 self.assertEquals(str(res[0]["revision"]), "1") self.assertEquals(str(res[0]["description"]), "test") # Check it's not in the local db - res = self.samba4.db.search(expression="(cn=test)", + res = self.samba4.db.search(expression="(cn=test)", scope=SCOPE_DEFAULT, attrs=attrs) self.assertEquals(len(res), 0) # Check it's not in the remote db - res = self.samba3.db.search(expression="(cn=test)", + res = self.samba3.db.search(expression="(cn=test)", scope=SCOPE_DEFAULT, attrs=attrs) self.assertEquals(len(res), 0) @@ -874,13 +874,13 @@ description: foo # Add remote record dn = self.samba4.dn("cn=test") dn2 = self.samba3.dn("cn=test") - self.samba3.db.add({"dn": dn2, + self.samba3.db.add({"dn": dn2, "cn": "test", "description": "foo", "sambaBadPasswordCount": "3", "sambaNextRid": "1001"}) # Check it's there - res = self.samba3.db.search(dn2, scope=SCOPE_BASE, + res = self.samba3.db.search(dn2, scope=SCOPE_BASE, attrs=["description", "sambaBadPasswordCount", "sambaNextRid"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn2) @@ -909,7 +909,7 @@ badPwdCount: 4 """ self.ldb.modify_ldif(ldif) # Check in mapped db - res = self.ldb.search(dn, scope=SCOPE_BASE, + res = self.ldb.search(dn, scope=SCOPE_BASE, attrs=["description", "badPwdCount", "nextRid"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) @@ -917,7 +917,7 @@ badPwdCount: 4 self.assertEquals(str(res[0]["badPwdCount"]), "4") self.assertEquals(str(res[0]["nextRid"]), "1001") # Check in remote db - res = self.samba3.db.search(dn2, scope=SCOPE_BASE, + res = self.samba3.db.search(dn2, scope=SCOPE_BASE, attrs=["description", "sambaBadPasswordCount", "sambaNextRid"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn2) @@ -930,16 +930,16 @@ badPwdCount: 4 self.ldb.rename(dn, dn2) # Check in mapped db dn = dn2 - res = self.ldb.search(dn, scope=SCOPE_BASE, + res = self.ldb.search(dn, scope=SCOPE_BASE, attrs=["description", "badPwdCount", "nextRid"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn) self.assertEquals(str(res[0]["description"]), "test") self.assertEquals(str(res[0]["badPwdCount"]), "4") self.assertEquals(str(res[0]["nextRid"]), "1001") - # Check in remote db + # Check in remote db dn2 = self.samba3.dn("cn=toast") - res = self.samba3.db.search(dn2, scope=SCOPE_BASE, + res = self.samba3.db.search(dn2, scope=SCOPE_BASE, attrs=["description", "sambaBadPasswordCount", "sambaNextRid"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn2) @@ -961,7 +961,7 @@ badPwdCount: 4 # Add remote record (same as before) dn = self.samba4.dn("cn=test") dn2 = self.samba3.dn("cn=test") - self.samba3.db.add({"dn": dn2, + self.samba3.db.add({"dn": dn2, "cn": "test", "description": "foo", "sambaBadPasswordCount": "3", @@ -1030,7 +1030,7 @@ description: test self.assertTrue(not "nextRid" in res[0]) self.assertEquals(str(res[0]["revision"]), "1") # Check in remote db - attrs = ["description", "sambaBadPasswordCount", "sambaNextRid", + attrs = ["description", "sambaBadPasswordCount", "sambaNextRid", "revision"] res = self.samba3.db.search(dn2, scope=SCOPE_BASE, attrs=attrs) self.assertEquals(len(res), 1) @@ -1069,7 +1069,7 @@ revision: 2 self.assertTrue(not "nextRid" in res[0]) self.assertEquals(str(res[0]["revision"]), "2") # Check in remote db - attrs = ["description", "sambaBadPasswordCount", "sambaNextRid", + attrs = ["description", "sambaBadPasswordCount", "sambaNextRid", "revision"] res = self.samba3.db.search(dn2, scope=SCOPE_BASE, attrs=attrs) self.assertEquals(len(res), 1) @@ -1102,8 +1102,8 @@ revision: 2 self.assertEquals(str(res[0]["revision"]), "2") # Check in remote db dn2 = self.samba3.dn("cn=toast") - res = self.samba3.db.search(dn2, scope=SCOPE_BASE, - attrs=["description", "sambaBadPasswordCount", "sambaNextRid", + res = self.samba3.db.search(dn2, scope=SCOPE_BASE, + attrs=["description", "sambaBadPasswordCount", "sambaNextRid", "revision"]) self.assertEquals(len(res), 1) self.assertEquals(str(res[0].dn), dn2) diff --git a/source4/scripting/python/samba/tests/samba_tool/ntacl.py b/source4/scripting/python/samba/tests/samba_tool/ntacl.py index d00b9a01f3..2a329fe7d4 100644 --- a/source4/scripting/python/samba/tests/samba_tool/ntacl.py +++ b/source4/scripting/python/samba/tests/samba_tool/ntacl.py @@ -29,14 +29,14 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest): def test_ntvfs(self): - (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", + (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", "--use-ntvfs") self.assertCmdSuccess(result) self.assertEquals(out,"","Shouldn't be any output messages") self.assertIn("Please note that POSIX permissions have NOT been changed, only the stored NT ACL", err) def test_s3fs(self): - (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", + (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", "--use-s3fs") self.assertCmdSuccess(result) @@ -44,7 +44,7 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest): self.assertEquals(out,"","Shouldn't be any output messages") def test_ntvfs_check(self): - (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", + (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", "--use-ntvfs") self.assertCmdSuccess(result) self.assertEquals(out,"","Shouldn't be any output messages") @@ -56,7 +56,7 @@ class NtACLCmdSysvolTestCase(SambaToolCmdTest): self.assertEquals(out,"","Shouldn't be any output messages") def test_s3fs_check(self): - (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", + (result, out, err) = self.runsubcmd("ntacl", "sysvolreset", "--use-s3fs") self.assertCmdSuccess(result) diff --git a/source4/scripting/python/samba/tests/samdb.py b/source4/scripting/python/samba/tests/samdb.py index c9537f5833..5c80391cba 100644 --- a/source4/scripting/python/samba/tests/samdb.py +++ b/source4/scripting/python/samba/tests/samdb.py @@ -54,7 +54,7 @@ class SamDBTestCase(TestCaseInTempDir): hostname="foo" domain="EXAMPLE" - dnsdomain="example.com" + dnsdomain="example.com" serverrole="domain controller" policyguid_dc = DEFAULT_DC_POLICY_GUID @@ -65,10 +65,10 @@ class SamDBTestCase(TestCaseInTempDir): self.lp = param.LoadParm() self.lp.load(smbconf) - names = guess_names(lp=self.lp, hostname=hostname, - domain=domain, dnsdomain=dnsdomain, - serverrole=serverrole, - domaindn=self.domaindn, configdn=configdn, + names = guess_names(lp=self.lp, hostname=hostname, + domain=domain, dnsdomain=dnsdomain, + serverrole=serverrole, + domaindn=self.domaindn, configdn=configdn, schemadn=schemadn) paths = provision_paths_from_lp(self.lp, names.dnsdomain) diff --git a/source4/scripting/python/samba/tests/upgradeprovision.py b/source4/scripting/python/samba/tests/upgradeprovision.py index 85b7cc7e2b..c1c70c4a88 100644 --- a/source4/scripting/python/samba/tests/upgradeprovision.py +++ b/source4/scripting/python/samba/tests/upgradeprovision.py @@ -18,7 +18,7 @@ """Tests for samba.upgradeprovision.""" import os -from samba.upgradehelpers import (usn_in_range, dn_sort, +from samba.upgradehelpers import (usn_in_range, dn_sort, get_diff_sddls, update_secrets, construct_existor_expr) diff --git a/source4/scripting/python/samba/tests/xattr.py b/source4/scripting/python/samba/tests/xattr.py index 34e95b57bc..89add28456 100644 --- a/source4/scripting/python/samba/tests/xattr.py +++ b/source4/scripting/python/samba/tests/xattr.py @@ -48,7 +48,7 @@ class XattrTests(TestCase): tempf = self._tmpfilename() open(tempf, 'w').write("empty") try: - samba.xattr_native.wrap_setxattr(tempf, "user.unittests", + samba.xattr_native.wrap_setxattr(tempf, "user.unittests", ndr_pack(ntacl)) except IOError: raise TestSkipped("the filesystem where the tests are runned do not support XATTR") |