Fix PEP8
This commit is contained in:
parent
86fcb16e8b
commit
1e4a08420b
@ -79,7 +79,7 @@ class FakeSWConnection(object):
|
||||
tenant, user = self.mainargs[1].split(':')
|
||||
tenant_id = TENANTS_LIST[tenant]['id']
|
||||
return ('%s/v1/AUTH_%s' % (STORAGE_DEST, tenant_id), 'token')
|
||||
|
||||
|
||||
def get_container(*args, **kargs):
|
||||
pass
|
||||
|
||||
@ -88,13 +88,14 @@ class FakeSWConnection(object):
|
||||
|
||||
def put_container(self, *args, **kargs):
|
||||
pass
|
||||
|
||||
|
||||
def put_object(self, *args, **kargs):
|
||||
pass
|
||||
|
||||
def get_account(self, *args, **kargs):
|
||||
pass
|
||||
|
||||
|
||||
class FakeSWObject(object):
|
||||
def __init__(self, object_name):
|
||||
pass
|
||||
@ -109,7 +110,7 @@ class FakeSWClient(object):
|
||||
def get_account(*args, **kwargs):
|
||||
return (('x-foo', 'x-bar'),
|
||||
[x[0] for x in CONTAINERS_LIST])
|
||||
|
||||
|
||||
|
||||
def fake_get_auth(auth_url, tenant, user, password):
|
||||
return FakeSWConnection(
|
||||
@ -130,6 +131,7 @@ class FakeKSTenant(object):
|
||||
def __str__(self):
|
||||
return self.tenant_name
|
||||
|
||||
|
||||
class FakeKSUser(object):
|
||||
def __init__(self):
|
||||
self.id = uuid.uuid4().hex
|
||||
@ -152,13 +154,16 @@ class FakeKSRole(object):
|
||||
class FakeKSClientRoles(object):
|
||||
def add_user_role(self, *args):
|
||||
pass
|
||||
|
||||
def list(self):
|
||||
return [FakeKSRole(),]
|
||||
return [FakeKSRole(), ]
|
||||
|
||||
|
||||
class FakeKSClientTenant(object):
|
||||
def list(self):
|
||||
for t in list(TENANTS_LIST):
|
||||
yield FakeKSTenant(t)
|
||||
|
||||
def create(self, account):
|
||||
return FakeKSTenant(TENANTS_LIST.keys()[0])
|
||||
|
||||
|
@ -35,7 +35,7 @@ class TestFiller(test_base.TestCase):
|
||||
FakeSWConnection)
|
||||
|
||||
def get_connection(self, *args):
|
||||
return swiftclient.client.Connection(get_config( \
|
||||
return swiftclient.client.Connection(get_config(
|
||||
'auth', 'keystone_origin'),
|
||||
'test', 'password',
|
||||
tenant_name='test')
|
||||
@ -47,9 +47,7 @@ class TestFiller(test_base.TestCase):
|
||||
def put_container(*args, **kwargs):
|
||||
get_containers_created.append(args[1])
|
||||
|
||||
self.stubs.Set(FakeSWConnection,
|
||||
'put_container',
|
||||
put_container)
|
||||
self.stubs.Set(FakeSWConnection, 'put_container', put_container)
|
||||
cnx = self.get_connection()
|
||||
filler.create_containers(cnx, 'test', 3, return_dict_ref)
|
||||
self.assertEqual(len(get_containers_created), 3)
|
||||
@ -61,8 +59,7 @@ class TestFiller(test_base.TestCase):
|
||||
def test_create_objects(self):
|
||||
get_object_created = []
|
||||
return_dict_ref = {'test': {'container_a': {'objects': []},
|
||||
'container_b': {'objects': []}}
|
||||
}
|
||||
'container_b': {'objects': []}}}
|
||||
|
||||
def put_object(*args, **kwargs):
|
||||
get_object_created.append(args[1:])
|
||||
@ -84,8 +81,10 @@ class TestFiller(test_base.TestCase):
|
||||
|
||||
def create_objects(*args, **kwargs):
|
||||
self.obj_cnt += 1
|
||||
|
||||
def create_containers(*args, **kwargs):
|
||||
self.cont_cnt += 1
|
||||
|
||||
def swift_cnx(*args, **kargs):
|
||||
return self.get_connection()
|
||||
|
||||
@ -109,6 +108,7 @@ class TestFiller(test_base.TestCase):
|
||||
def create(*args, **kargs):
|
||||
self.create_cnt += 1
|
||||
return FakeKSUser()
|
||||
|
||||
def add_user_role(*args, **kargs):
|
||||
self.role_cnt += 1
|
||||
|
||||
@ -125,7 +125,7 @@ class TestFiller(test_base.TestCase):
|
||||
def test_create_swift_account(self):
|
||||
self.ret_index = {}
|
||||
self.user_cnt = 0
|
||||
|
||||
|
||||
def create_swift_user(*args):
|
||||
self.user_cnt += 1
|
||||
|
||||
@ -153,7 +153,7 @@ class TestFiller(test_base.TestCase):
|
||||
client.tenants.delete = delete_t
|
||||
client.users.delete = delete_u
|
||||
filler.delete_account(client,
|
||||
[FakeKSUser().id,],
|
||||
[FakeKSUser().id, ],
|
||||
('account1', 'account1_id'))
|
||||
|
||||
self.assertEqual(self.delete_t_cnt, 1)
|
||||
@ -165,13 +165,15 @@ class TestFiller(test_base.TestCase):
|
||||
self.cnt_do = 0
|
||||
|
||||
filler.swift_cnx = self.get_connection
|
||||
|
||||
|
||||
def get_account(*args, **kwargs):
|
||||
self.cnt_ga += 1
|
||||
return (None,({'name': 'cont1'}, {'name': 'cont2'}))
|
||||
return (None, ({'name': 'cont1'}, {'name': 'cont2'}))
|
||||
|
||||
def get_container(*args, **kwargs):
|
||||
self.cnt_co += 1
|
||||
return (None,({'name': 'obj1'}, {'name': 'obj2'}))
|
||||
return (None, ({'name': 'obj1'}, {'name': 'obj2'}))
|
||||
|
||||
def delete_object(*args, **kwargs):
|
||||
self.cnt_do += 1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user