Merge ""pool_group" word should be used instead "pool""
This commit is contained in:
@@ -19,12 +19,12 @@ from zaqarclient.queues.v1 import core
|
|||||||
class Flavor(object):
|
class Flavor(object):
|
||||||
|
|
||||||
def __init__(self, client, name,
|
def __init__(self, client, name,
|
||||||
pool=None, auto_create=True,
|
pool_group=None, auto_create=True,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.pool = pool
|
self.pool_group = pool_group
|
||||||
self.capabilities = kwargs.get('capabilities', {})
|
self.capabilities = kwargs.get('capabilities', {})
|
||||||
|
|
||||||
if auto_create:
|
if auto_create:
|
||||||
@@ -44,7 +44,7 @@ class Flavor(object):
|
|||||||
# TBD(mdnadeem): Have to change this code when zaqar server
|
# TBD(mdnadeem): Have to change this code when zaqar server
|
||||||
# behaviour change for PUT operation.
|
# behaviour change for PUT operation.
|
||||||
|
|
||||||
data = {'pool': self.pool}
|
data = {'pool_group': self.pool_group}
|
||||||
if self.client.api_version <= 1.1:
|
if self.client.api_version <= 1.1:
|
||||||
data['capabilities'] = self.capabilities
|
data['capabilities'] = self.capabilities
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ from zaqarclient.transport import response
|
|||||||
class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
||||||
|
|
||||||
def test_flavor_create(self):
|
def test_flavor_create(self):
|
||||||
flavor_data = {'pool': 'stomach'}
|
flavor_data = {'pool_group': 'stomach'}
|
||||||
|
|
||||||
with mock.patch.object(self.transport, 'send',
|
with mock.patch.object(self.transport, 'send',
|
||||||
autospec=True) as send_method:
|
autospec=True) as send_method:
|
||||||
@@ -37,10 +37,10 @@ class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
|||||||
# since auto_create's default is True
|
# since auto_create's default is True
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
self.assertEqual('tasty', flavor.name)
|
self.assertEqual('tasty', flavor.name)
|
||||||
self.assertEqual('stomach', flavor.pool)
|
self.assertEqual('stomach', flavor.pool_group)
|
||||||
|
|
||||||
def test_flavor_get(self):
|
def test_flavor_get(self):
|
||||||
flavor_data = {'name': 'test', 'pool': 'stomach'}
|
flavor_data = {'name': 'test', 'pool_group': 'stomach'}
|
||||||
|
|
||||||
with mock.patch.object(self.transport, 'send',
|
with mock.patch.object(self.transport, 'send',
|
||||||
autospec=True) as send_method:
|
autospec=True) as send_method:
|
||||||
@@ -54,11 +54,11 @@ class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
|||||||
flavor = self.client.flavor('test')
|
flavor = self.client.flavor('test')
|
||||||
flavor1 = flavor.get()
|
flavor1 = flavor.get()
|
||||||
self.assertEqual('test', flavor1['name'])
|
self.assertEqual('test', flavor1['name'])
|
||||||
self.assertEqual('stomach', flavor1['pool'])
|
self.assertEqual('stomach', flavor1['pool_group'])
|
||||||
|
|
||||||
def test_flavor_update(self):
|
def test_flavor_update(self):
|
||||||
flavor_data = {'pool': 'stomach'}
|
flavor_data = {'pool_group': 'stomach'}
|
||||||
updated_data = {'pool': 'belly'}
|
updated_data = {'pool_group': 'belly'}
|
||||||
|
|
||||||
with mock.patch.object(self.transport, 'send',
|
with mock.patch.object(self.transport, 'send',
|
||||||
autospec=True) as send_method:
|
autospec=True) as send_method:
|
||||||
@@ -66,8 +66,8 @@ class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
|||||||
send_method.return_value = resp
|
send_method.return_value = resp
|
||||||
|
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
flavor.update({'pool': 'belly'})
|
flavor.update({'pool_group': 'belly'})
|
||||||
self.assertEqual('belly', flavor.pool)
|
self.assertEqual('belly', flavor.pool_group)
|
||||||
|
|
||||||
def test_flavor_list(self):
|
def test_flavor_list(self):
|
||||||
returned = {
|
returned = {
|
||||||
@@ -77,7 +77,7 @@ class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
|||||||
}],
|
}],
|
||||||
'flavors': [{
|
'flavors': [{
|
||||||
'name': 'tasty',
|
'name': 'tasty',
|
||||||
'pool': 'stomach'
|
'pool_group': 'stomach'
|
||||||
}]
|
}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class QueuesV1_1FlavorUnitTest(base.QueuesTestBase):
|
|||||||
self.assertEqual(1, len(list(flavor_var)))
|
self.assertEqual(1, len(list(flavor_var)))
|
||||||
|
|
||||||
def test_flavor_delete(self):
|
def test_flavor_delete(self):
|
||||||
flavor_data = {'pool': 'stomach'}
|
flavor_data = {'pool_group': 'stomach'}
|
||||||
|
|
||||||
with mock.patch.object(self.transport, 'send',
|
with mock.patch.object(self.transport, 'send',
|
||||||
autospec=True) as send_method:
|
autospec=True) as send_method:
|
||||||
@@ -120,12 +120,12 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase):
|
|||||||
pool = self.client.pool('stomach', **pool_data)
|
pool = self.client.pool('stomach', **pool_data)
|
||||||
self.addCleanup(pool.delete)
|
self.addCleanup(pool.delete)
|
||||||
|
|
||||||
flavor_data = {'pool': 'us'}
|
flavor_data = {'pool_group': 'us'}
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
self.addCleanup(flavor.delete)
|
self.addCleanup(flavor.delete)
|
||||||
|
|
||||||
self.assertEqual('tasty', flavor.name)
|
self.assertEqual('tasty', flavor.name)
|
||||||
self.assertEqual('us', flavor.pool)
|
self.assertEqual('us', flavor.pool_group)
|
||||||
|
|
||||||
def test_flavor_get(self):
|
def test_flavor_get(self):
|
||||||
pool_data = {'weight': 10,
|
pool_data = {'weight': 10,
|
||||||
@@ -135,13 +135,13 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase):
|
|||||||
pool = self.client.pool('stomach', **pool_data)
|
pool = self.client.pool('stomach', **pool_data)
|
||||||
self.addCleanup(pool.delete)
|
self.addCleanup(pool.delete)
|
||||||
|
|
||||||
flavor_data = {'pool': 'us'}
|
flavor_data = {'pool_group': 'us'}
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
resp_data = flavor.get()
|
resp_data = flavor.get()
|
||||||
self.addCleanup(flavor.delete)
|
self.addCleanup(flavor.delete)
|
||||||
|
|
||||||
self.assertEqual('tasty', resp_data['name'])
|
self.assertEqual('tasty', resp_data['name'])
|
||||||
self.assertEqual('us', resp_data['pool'])
|
self.assertEqual('us', resp_data['pool_group'])
|
||||||
|
|
||||||
def test_flavor_update(self):
|
def test_flavor_update(self):
|
||||||
pool_data = {'weight': 10,
|
pool_data = {'weight': 10,
|
||||||
@@ -151,12 +151,12 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase):
|
|||||||
pool = self.client.pool('stomach', **pool_data)
|
pool = self.client.pool('stomach', **pool_data)
|
||||||
self.addCleanup(pool.delete)
|
self.addCleanup(pool.delete)
|
||||||
|
|
||||||
flavor_data = {'pool': 'us'}
|
flavor_data = {'pool_group': 'us'}
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
self.addCleanup(flavor.delete)
|
self.addCleanup(flavor.delete)
|
||||||
pool.update({'group': 'belly'})
|
pool.update({'group': 'belly'})
|
||||||
flavor.update({'pool': 'belly'})
|
flavor.update({'pool_group': 'belly'})
|
||||||
self.assertEqual('belly', flavor.pool)
|
self.assertEqual('belly', flavor.pool_group)
|
||||||
|
|
||||||
def test_flavor_list(self):
|
def test_flavor_list(self):
|
||||||
pool_data = {'uri': 'mongodb://127.0.0.1:27017',
|
pool_data = {'uri': 'mongodb://127.0.0.1:27017',
|
||||||
@@ -166,7 +166,7 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase):
|
|||||||
pool = self.client.pool('stomach', **pool_data)
|
pool = self.client.pool('stomach', **pool_data)
|
||||||
self.addCleanup(pool.delete)
|
self.addCleanup(pool.delete)
|
||||||
|
|
||||||
flavor_data = {'pool': 'us'}
|
flavor_data = {'pool_group': 'us'}
|
||||||
flavor = self.client.flavor("test_flavor", **flavor_data)
|
flavor = self.client.flavor("test_flavor", **flavor_data)
|
||||||
self.addCleanup(flavor.delete)
|
self.addCleanup(flavor.delete)
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ class QueuesV1_1FlavorFunctionalTest(base.QueuesTestBase):
|
|||||||
pool = self.client.pool('stomach', **pool_data)
|
pool = self.client.pool('stomach', **pool_data)
|
||||||
self.addCleanup(pool.delete)
|
self.addCleanup(pool.delete)
|
||||||
|
|
||||||
flavor_data = {'pool': 'us'}
|
flavor_data = {'pool_group': 'us'}
|
||||||
flavor = self.client.flavor('tasty', **flavor_data)
|
flavor = self.client.flavor('tasty', **flavor_data)
|
||||||
flavor.delete()
|
flavor.delete()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user