mirror of
https://github.com/samba-team/samba.git
synced 2025-12-14 20:23:54 +03:00
PEP8: fix E306: expected 1 blank line before a nested definition, found 0
Signed-off-by: Joe Guo <joeg@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
@@ -2038,6 +2038,7 @@ class DnTests(TestCase):
|
|||||||
|
|
||||||
def test_set_dn_invalid(self):
|
def test_set_dn_invalid(self):
|
||||||
x = ldb.Message()
|
x = ldb.Message()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
x.dn = "astring"
|
x.dn = "astring"
|
||||||
self.assertRaises(TypeError, assign)
|
self.assertRaises(TypeError, assign)
|
||||||
@@ -2617,6 +2618,7 @@ class ModuleTests(TestCase):
|
|||||||
|
|
||||||
def test_use_module(self):
|
def test_use_module(self):
|
||||||
ops = []
|
ops = []
|
||||||
|
|
||||||
class ExampleModule:
|
class ExampleModule:
|
||||||
name = "bla"
|
name = "bla"
|
||||||
|
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ class ContextTests(TestCase):
|
|||||||
def test_timer_deallocate_timer(self):
|
def test_timer_deallocate_timer(self):
|
||||||
"""Test timer is scheduled even if reference to it isn't held"""
|
"""Test timer is scheduled even if reference to it isn't held"""
|
||||||
collecting_list = []
|
collecting_list = []
|
||||||
|
|
||||||
def callback(t):
|
def callback(t):
|
||||||
collecting_list.append(True)
|
collecting_list.append(True)
|
||||||
timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True))
|
timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True))
|
||||||
@@ -89,6 +90,7 @@ class ContextTests(TestCase):
|
|||||||
def test_timer_deallocate_context(self):
|
def test_timer_deallocate_context(self):
|
||||||
"""Test timer is unscheduled when context is freed"""
|
"""Test timer is unscheduled when context is freed"""
|
||||||
collecting_list = []
|
collecting_list = []
|
||||||
|
|
||||||
def callback(t):
|
def callback(t):
|
||||||
collecting_list.append(True)
|
collecting_list.append(True)
|
||||||
timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True))
|
timer = self.ctx.add_timer(0, lambda t: collecting_list.append(True))
|
||||||
|
|||||||
@@ -996,6 +996,7 @@ class GetPasswordCommand(Command):
|
|||||||
del obj["userPrincipalName"]
|
del obj["userPrincipalName"]
|
||||||
|
|
||||||
calculated = {}
|
calculated = {}
|
||||||
|
|
||||||
def get_package(name, min_idx=0):
|
def get_package(name, min_idx=0):
|
||||||
if name in calculated:
|
if name in calculated:
|
||||||
return calculated[name]
|
return calculated[name]
|
||||||
@@ -1068,6 +1069,7 @@ class GetPasswordCommand(Command):
|
|||||||
# Extract the WDigest hash for the value specified by i.
|
# Extract the WDigest hash for the value specified by i.
|
||||||
# Builds an htdigest compatible value
|
# Builds an htdigest compatible value
|
||||||
DIGEST = "Digest"
|
DIGEST = "Digest"
|
||||||
|
|
||||||
def get_wDigest(i, primary_wdigest, account_name, account_upn,
|
def get_wDigest(i, primary_wdigest, account_name, account_upn,
|
||||||
domain, dns_domain):
|
domain, dns_domain):
|
||||||
if i == 1:
|
if i == 1:
|
||||||
|
|||||||
@@ -35,18 +35,21 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_negative_int_into_hyper(self):
|
def test_negative_int_into_hyper(self):
|
||||||
s = server_id.server_id()
|
s = server_id.server_id()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.unique_id = -1
|
s.unique_id = -1
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_hyper_into_uint32(self):
|
def test_hyper_into_uint32(self):
|
||||||
s = server_id.server_id()
|
s = server_id.server_id()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.vnn = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
s.vnn = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_hyper_into_int32(self):
|
def test_hyper_into_int32(self):
|
||||||
s = srvsvc.NetRemoteTODInfo()
|
s = srvsvc.NetRemoteTODInfo()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.timezone = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
s.timezone = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
@@ -58,6 +61,7 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_uint32_into_int32(self):
|
def test_uint32_into_int32(self):
|
||||||
s = srvsvc.NetRemoteTODInfo()
|
s = srvsvc.NetRemoteTODInfo()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.timezone = server_id.NONCLUSTER_VNN
|
s.timezone = server_id.NONCLUSTER_VNN
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
@@ -69,6 +73,7 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_larger_long_int_into_int32(self):
|
def test_larger_long_int_into_int32(self):
|
||||||
s = srvsvc.NetRemoteTODInfo()
|
s = srvsvc.NetRemoteTODInfo()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.timezone = 2147483648
|
s.timezone = 2147483648
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
@@ -80,12 +85,14 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_float_into_int32(self):
|
def test_float_into_int32(self):
|
||||||
s = srvsvc.NetRemoteTODInfo()
|
s = srvsvc.NetRemoteTODInfo()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.timezone = 2.5
|
s.timezone = 2.5
|
||||||
self.assertRaises(TypeError, assign)
|
self.assertRaises(TypeError, assign)
|
||||||
|
|
||||||
def test_int_float_into_int32(self):
|
def test_int_float_into_int32(self):
|
||||||
s = srvsvc.NetRemoteTODInfo()
|
s = srvsvc.NetRemoteTODInfo()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.timezone = 2.0
|
s.timezone = 2.0
|
||||||
self.assertRaises(TypeError, assign)
|
self.assertRaises(TypeError, assign)
|
||||||
@@ -97,36 +104,42 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_negative_into_uint32(self):
|
def test_negative_into_uint32(self):
|
||||||
s = server_id.server_id()
|
s = server_id.server_id()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.vnn = -1
|
s.vnn = -1
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_hyper_into_uint16(self):
|
def test_hyper_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
g.time_mid = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_int_into_uint16(self):
|
def test_int_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = 200000
|
g.time_mid = 200000
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_negative_int_into_uint16(self):
|
def test_negative_int_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = -2
|
g.time_mid = -2
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_int_into_uint16(self):
|
def test_int_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = 200000
|
g.time_mid = 200000
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_negative_int_into_uint16(self):
|
def test_negative_int_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = -2
|
g.time_mid = -2
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
@@ -143,18 +156,21 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_overflow_bitmap_into_uint16(self):
|
def test_overflow_bitmap_into_uint16(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = misc.SV_TYPE_LOCAL_LIST_ONLY
|
g.time_mid = misc.SV_TYPE_LOCAL_LIST_ONLY
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_overflow_bitmap_into_uint16_2(self):
|
def test_overflow_bitmap_into_uint16_2(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.time_mid = misc.SV_TYPE_DOMAIN_ENUM
|
g.time_mid = misc.SV_TYPE_DOMAIN_ENUM
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_hyper_into_int64(self):
|
def test_hyper_into_int64(self):
|
||||||
s = samr.DomInfo1()
|
s = samr.DomInfo1()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
s.max_password_age = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
s.max_password_age = server_id.SERVERID_UNIQUE_ID_NOT_TO_VERIFY
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
@@ -191,24 +207,28 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_negative_list_over_uint8_list(self):
|
def test_negative_list_over_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node = [-1, 0, 5, 0, 7, 4]
|
g.node = [-1, 0, 5, 0, 7, 4]
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_overflow_list_over_uint8_list(self):
|
def test_overflow_list_over_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node = [256, 0, 5, 0, 7, 4]
|
g.node = [256, 0, 5, 0, 7, 4]
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_short_list_over_uint8_list(self):
|
def test_short_list_over_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node = [5, 0, 5]
|
g.node = [5, 0, 5]
|
||||||
self.assertRaises(TypeError, assign)
|
self.assertRaises(TypeError, assign)
|
||||||
|
|
||||||
def test_long_list_over_uint8_list(self):
|
def test_long_list_over_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node = [5, 0, 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
|
g.node = [5, 0, 5, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
|
||||||
self.assertRaises(TypeError, assign)
|
self.assertRaises(TypeError, assign)
|
||||||
@@ -225,12 +245,14 @@ class IntegerTests(samba.tests.TestCase):
|
|||||||
|
|
||||||
def test_negative_into_uint8_list(self):
|
def test_negative_into_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node[1] = -1
|
g.node[1] = -1
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|
||||||
def test_overflow_into_uint8_list(self):
|
def test_overflow_into_uint8_list(self):
|
||||||
g = misc.GUID()
|
g = misc.GUID()
|
||||||
|
|
||||||
def assign():
|
def assign():
|
||||||
g.node[1] = 256
|
g.node[1] = 256
|
||||||
self.assertRaises(OverflowError, assign)
|
self.assertRaises(OverflowError, assign)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ class MessagingTests(TestCase):
|
|||||||
|
|
||||||
def test_register(self):
|
def test_register(self):
|
||||||
x = self.get_context()
|
x = self.get_context()
|
||||||
|
|
||||||
def callback():
|
def callback():
|
||||||
pass
|
pass
|
||||||
msg_type = x.register((callback, None))
|
msg_type = x.register((callback, None))
|
||||||
@@ -82,6 +83,7 @@ class MessagingTests(TestCase):
|
|||||||
msg_ping = 0
|
msg_ping = 0
|
||||||
|
|
||||||
server_ctx = self.get_context((0, 1))
|
server_ctx = self.get_context((0, 1))
|
||||||
|
|
||||||
def ping_callback(got_ping, msg_type, src, data):
|
def ping_callback(got_ping, msg_type, src, data):
|
||||||
got_ping["count"] += 1
|
got_ping["count"] += 1
|
||||||
server_ctx.send(src, msg_pong, data)
|
server_ctx.send(src, msg_pong, data)
|
||||||
@@ -123,6 +125,7 @@ class MessagingTests(TestCase):
|
|||||||
|
|
||||||
pid = os.getpid()
|
pid = os.getpid()
|
||||||
server_ctx = self.get_context((pid, 1))
|
server_ctx = self.get_context((pid, 1))
|
||||||
|
|
||||||
def ping_callback(got_ping, msg_type, src, data):
|
def ping_callback(got_ping, msg_type, src, data):
|
||||||
got_ping["count"] += 1
|
got_ping["count"] += 1
|
||||||
server_ctx.send(src, msg_pong, data)
|
server_ctx.send(src, msg_pong, data)
|
||||||
|
|||||||
@@ -295,6 +295,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase):
|
|||||||
|
|
||||||
samdb = samba.tests.connect_samdb("ldb://" + os.path.join(self.tempdir, "private", "sam.ldb"),
|
samdb = samba.tests.connect_samdb("ldb://" + os.path.join(self.tempdir, "private", "sam.ldb"),
|
||||||
ldap_only=False, lp=self.get_loadparm())
|
ldap_only=False, lp=self.get_loadparm())
|
||||||
|
|
||||||
def get_krbtgt_pw():
|
def get_krbtgt_pw():
|
||||||
krbtgt_pw = samdb.searchone("unicodePwd", "cn=krbtgt,CN=users,%s" % nc_name)
|
krbtgt_pw = samdb.searchone("unicodePwd", "cn=krbtgt,CN=users,%s" % nc_name)
|
||||||
self.assertRaises(KeyError, get_krbtgt_pw)
|
self.assertRaises(KeyError, get_krbtgt_pw)
|
||||||
@@ -413,6 +414,7 @@ class SambaToolDrsTests(drs_base.DrsBaseTestCase):
|
|||||||
server_ldap_service_name = str(server_rootdse["ldapServiceName"][0])
|
server_ldap_service_name = str(server_rootdse["ldapServiceName"][0])
|
||||||
server_realm = server_ldap_service_name.split(":")[0]
|
server_realm = server_ldap_service_name.split(":")[0]
|
||||||
creds = self.get_credentials()
|
creds = self.get_credentials()
|
||||||
|
|
||||||
def attempt_clone():
|
def attempt_clone():
|
||||||
out = self.check_output("samba-tool drs clone-dc-database %s --server=%s %s"
|
out = self.check_output("samba-tool drs clone-dc-database %s --server=%s %s"
|
||||||
% (server_realm,
|
% (server_realm,
|
||||||
|
|||||||
Reference in New Issue
Block a user