tests: Rename 'compute_sdk_client' -> 'compute_client'
Resolve a TODO. Achieved using: sed -i 's/self.compute_sdk_client/self.compute_client/' \ $(ag -w self.compute_sdk_client -l) Change-Id: I76798058b9dee9fc7ef01ff8656543fbb1266d43 Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
dae2539490
commit
dc68be6b7b
openstackclient/tests/unit
api
common
compute/v2
fakes.pytest_agent.pytest_aggregate.pytest_console.pytest_flavor.pytest_host.pytest_hypervisor.pytest_hypervisor_stats.pytest_keypair.pytest_server.pytest_server_backup.pytest_server_event.pytest_server_group.pytest_server_image.pytest_server_migration.pytest_server_volume.pytest_service.pytest_usage.py
network/v2
test_floating_ip_compute.pytest_floating_ip_pool_compute.pytest_network_compute.pytest_port.pytest_security_group_compute.pytest_security_group_rule_compute.py
volume/v3
@ -29,7 +29,7 @@ class TestSecurityGroup(utils.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client = mock.Mock(_proxy.Proxy)
|
||||
self.compute_client = mock.Mock(_proxy.Proxy)
|
||||
|
||||
def test_create_security_group(self):
|
||||
sg_name = 'name-' + uuid.uuid4().hex
|
||||
@ -43,15 +43,13 @@ class TestSecurityGroup(utils.TestCase):
|
||||
'rules': [],
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.post.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.create_security_group(
|
||||
self.compute_sdk_client, sg_name, sg_description
|
||||
self.compute_client, sg_name, sg_description
|
||||
)
|
||||
|
||||
self.compute_sdk_client.post.assert_called_once_with(
|
||||
self.compute_client.post.assert_called_once_with(
|
||||
'/os-security-groups',
|
||||
data={'name': sg_name, 'description': sg_description},
|
||||
microversion='2.1',
|
||||
@ -70,13 +68,11 @@ class TestSecurityGroup(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.list_security_groups(self.compute_sdk_client)
|
||||
result = compute.list_security_groups(self.compute_client)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-security-groups', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['security_groups'], result)
|
||||
@ -93,13 +89,13 @@ class TestSecurityGroup(utils.TestCase):
|
||||
'rules': [],
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
|
||||
result = compute.find_security_group(self.compute_sdk_client, sg_id)
|
||||
result = compute.find_security_group(self.compute_client, sg_id)
|
||||
|
||||
self.compute_sdk_client.get.assert_has_calls(
|
||||
self.compute_client.get.assert_has_calls(
|
||||
[
|
||||
mock.call(f'/os-security-groups/{sg_id}', microversion='2.1'),
|
||||
]
|
||||
@ -120,14 +116,14 @@ class TestSecurityGroup(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
|
||||
result = compute.find_security_group(self.compute_sdk_client, sg_name)
|
||||
result = compute.find_security_group(self.compute_client, sg_name)
|
||||
|
||||
self.compute_sdk_client.get.assert_has_calls(
|
||||
self.compute_client.get.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
f'/os-security-groups/{sg_name}', microversion='2.1'
|
||||
@ -139,14 +135,14 @@ class TestSecurityGroup(utils.TestCase):
|
||||
|
||||
def test_find_security_group_not_found(self):
|
||||
data = {'security_groups': []}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
self.assertRaises(
|
||||
osc_lib_exceptions.NotFound,
|
||||
compute.find_security_group,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
'invalid-sg',
|
||||
)
|
||||
|
||||
@ -170,7 +166,7 @@ class TestSecurityGroup(utils.TestCase):
|
||||
},
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
@ -178,7 +174,7 @@ class TestSecurityGroup(utils.TestCase):
|
||||
self.assertRaises(
|
||||
osc_lib_exceptions.NotFound,
|
||||
compute.find_security_group,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
sg_name,
|
||||
)
|
||||
|
||||
@ -195,15 +191,13 @@ class TestSecurityGroup(utils.TestCase):
|
||||
'rules': [],
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.put.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.put.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.update_security_group(
|
||||
self.compute_sdk_client, sg_id, sg_name, sg_description
|
||||
self.compute_client, sg_id, sg_name, sg_description
|
||||
)
|
||||
|
||||
self.compute_sdk_client.put.assert_called_once_with(
|
||||
self.compute_client.put.assert_called_once_with(
|
||||
f'/os-security-groups/{sg_id}',
|
||||
data={'name': sg_name, 'description': sg_description},
|
||||
microversion='2.1',
|
||||
@ -212,13 +206,13 @@ class TestSecurityGroup(utils.TestCase):
|
||||
|
||||
def test_delete_security_group(self):
|
||||
sg_id = uuid.uuid4().hex
|
||||
self.compute_sdk_client.delete.return_value = fakes.FakeResponse(
|
||||
self.compute_client.delete.return_value = fakes.FakeResponse(
|
||||
status_code=http.HTTPStatus.NO_CONTENT
|
||||
)
|
||||
|
||||
result = compute.delete_security_group(self.compute_sdk_client, sg_id)
|
||||
result = compute.delete_security_group(self.compute_client, sg_id)
|
||||
|
||||
self.compute_sdk_client.delete.assert_called_once_with(
|
||||
self.compute_client.delete.assert_called_once_with(
|
||||
f'/os-security-groups/{sg_id}',
|
||||
microversion='2.1',
|
||||
)
|
||||
@ -229,7 +223,7 @@ class TestSecurityGroupRule(utils.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client = mock.Mock(_proxy.Proxy)
|
||||
self.compute_client = mock.Mock(_proxy.Proxy)
|
||||
|
||||
def test_create_security_group_rule(self):
|
||||
sg_id = uuid.uuid4().hex
|
||||
@ -242,12 +236,10 @@ class TestSecurityGroupRule(utils.TestCase):
|
||||
'cidr': '10.0.0.0/24',
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.post.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.create_security_group_rule(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
security_group_id=sg_id,
|
||||
ip_protocol='tcp',
|
||||
from_port=22,
|
||||
@ -256,7 +248,7 @@ class TestSecurityGroupRule(utils.TestCase):
|
||||
remote_group=None,
|
||||
)
|
||||
|
||||
self.compute_sdk_client.post.assert_called_once_with(
|
||||
self.compute_client.post.assert_called_once_with(
|
||||
'/os-security-group-rules',
|
||||
data={
|
||||
'parent_group_id': sg_id,
|
||||
@ -272,15 +264,13 @@ class TestSecurityGroupRule(utils.TestCase):
|
||||
|
||||
def test_delete_security_group_rule(self):
|
||||
sg_id = uuid.uuid4().hex
|
||||
self.compute_sdk_client.delete.return_value = fakes.FakeResponse(
|
||||
self.compute_client.delete.return_value = fakes.FakeResponse(
|
||||
status_code=http.HTTPStatus.NO_CONTENT
|
||||
)
|
||||
|
||||
result = compute.delete_security_group_rule(
|
||||
self.compute_sdk_client, sg_id
|
||||
)
|
||||
result = compute.delete_security_group_rule(self.compute_client, sg_id)
|
||||
|
||||
self.compute_sdk_client.delete.assert_called_once_with(
|
||||
self.compute_client.delete.assert_called_once_with(
|
||||
f'/os-security-group-rules/{sg_id}',
|
||||
microversion='2.1',
|
||||
)
|
||||
@ -291,7 +281,7 @@ class TestNetwork(utils.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client = mock.Mock(_proxy.Proxy)
|
||||
self.compute_client = mock.Mock(_proxy.Proxy)
|
||||
|
||||
def test_create_network(self):
|
||||
net_name = 'name-' + uuid.uuid4().hex
|
||||
@ -305,18 +295,16 @@ class TestNetwork(utils.TestCase):
|
||||
# other fields omitted for brevity
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.post.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.create_network(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
name=net_name,
|
||||
subnet=net_subnet,
|
||||
share_subnet=True,
|
||||
)
|
||||
|
||||
self.compute_sdk_client.post.assert_called_once_with(
|
||||
self.compute_client.post.assert_called_once_with(
|
||||
'/os-networks',
|
||||
data={
|
||||
'label': net_name,
|
||||
@ -337,13 +325,11 @@ class TestNetwork(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.list_networks(self.compute_sdk_client)
|
||||
result = compute.list_networks(self.compute_client)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-networks', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['networks'], result)
|
||||
@ -358,13 +344,13 @@ class TestNetwork(utils.TestCase):
|
||||
# other fields omitted for brevity
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
|
||||
result = compute.find_network(self.compute_sdk_client, net_id)
|
||||
result = compute.find_network(self.compute_client, net_id)
|
||||
|
||||
self.compute_sdk_client.get.assert_has_calls(
|
||||
self.compute_client.get.assert_has_calls(
|
||||
[
|
||||
mock.call(f'/os-networks/{net_id}', microversion='2.1'),
|
||||
]
|
||||
@ -383,14 +369,14 @@ class TestNetwork(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
|
||||
result = compute.find_network(self.compute_sdk_client, net_name)
|
||||
result = compute.find_network(self.compute_client, net_name)
|
||||
|
||||
self.compute_sdk_client.get.assert_has_calls(
|
||||
self.compute_client.get.assert_has_calls(
|
||||
[
|
||||
mock.call(f'/os-networks/{net_name}', microversion='2.1'),
|
||||
mock.call('/os-networks', microversion='2.1'),
|
||||
@ -400,14 +386,14 @@ class TestNetwork(utils.TestCase):
|
||||
|
||||
def test_find_network_not_found(self):
|
||||
data = {'networks': []}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
self.assertRaises(
|
||||
osc_lib_exceptions.NotFound,
|
||||
compute.find_network,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
'invalid-net',
|
||||
)
|
||||
|
||||
@ -427,7 +413,7 @@ class TestNetwork(utils.TestCase):
|
||||
},
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
@ -435,19 +421,19 @@ class TestNetwork(utils.TestCase):
|
||||
self.assertRaises(
|
||||
osc_lib_exceptions.NotFound,
|
||||
compute.find_network,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
net_name,
|
||||
)
|
||||
|
||||
def test_delete_network(self):
|
||||
net_id = uuid.uuid4().hex
|
||||
self.compute_sdk_client.delete.return_value = fakes.FakeResponse(
|
||||
self.compute_client.delete.return_value = fakes.FakeResponse(
|
||||
status_code=http.HTTPStatus.NO_CONTENT
|
||||
)
|
||||
|
||||
result = compute.delete_network(self.compute_sdk_client, net_id)
|
||||
result = compute.delete_network(self.compute_client, net_id)
|
||||
|
||||
self.compute_sdk_client.delete.assert_called_once_with(
|
||||
self.compute_client.delete.assert_called_once_with(
|
||||
f'/os-networks/{net_id}', microversion='2.1'
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -457,7 +443,7 @@ class TestFloatingIP(utils.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client = mock.Mock(_proxy.Proxy)
|
||||
self.compute_client = mock.Mock(_proxy.Proxy)
|
||||
|
||||
def test_create_floating_ip(self):
|
||||
network = 'network-' + uuid.uuid4().hex
|
||||
@ -470,15 +456,13 @@ class TestFloatingIP(utils.TestCase):
|
||||
'pool': network,
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.post.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.post.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.create_floating_ip(
|
||||
self.compute_sdk_client, network=network
|
||||
self.compute_client, network=network
|
||||
)
|
||||
|
||||
self.compute_sdk_client.post.assert_called_once_with(
|
||||
self.compute_client.post.assert_called_once_with(
|
||||
'/os-floating-ips', data={'pool': network}, microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['floating_ip'], result)
|
||||
@ -495,13 +479,11 @@ class TestFloatingIP(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.list_floating_ips(self.compute_sdk_client)
|
||||
result = compute.list_floating_ips(self.compute_client)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-floating-ips', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['floating_ips'], result)
|
||||
@ -517,26 +499,26 @@ class TestFloatingIP(utils.TestCase):
|
||||
'pool': f'network-{uuid.uuid4().hex}',
|
||||
}
|
||||
}
|
||||
self.compute_sdk_client.get.side_effect = [
|
||||
self.compute_client.get.side_effect = [
|
||||
fakes.FakeResponse(data=data),
|
||||
]
|
||||
|
||||
result = compute.get_floating_ip(self.compute_sdk_client, fip_id)
|
||||
result = compute.get_floating_ip(self.compute_client, fip_id)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
f'/os-floating-ips/{fip_id}', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['floating_ip'], result)
|
||||
|
||||
def test_delete_floating_ip(self):
|
||||
fip_id = uuid.uuid4().hex
|
||||
self.compute_sdk_client.delete.return_value = fakes.FakeResponse(
|
||||
self.compute_client.delete.return_value = fakes.FakeResponse(
|
||||
status_code=http.HTTPStatus.NO_CONTENT
|
||||
)
|
||||
|
||||
result = compute.delete_floating_ip(self.compute_sdk_client, fip_id)
|
||||
result = compute.delete_floating_ip(self.compute_client, fip_id)
|
||||
|
||||
self.compute_sdk_client.delete.assert_called_once_with(
|
||||
self.compute_client.delete.assert_called_once_with(
|
||||
f'/os-floating-ips/{fip_id}', microversion='2.1'
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -546,7 +528,7 @@ class TestFloatingIPPool(utils.TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client = mock.Mock(_proxy.Proxy)
|
||||
self.compute_client = mock.Mock(_proxy.Proxy)
|
||||
|
||||
def test_list_floating_ip_pools(self):
|
||||
data = {
|
||||
@ -556,13 +538,11 @@ class TestFloatingIPPool(utils.TestCase):
|
||||
}
|
||||
],
|
||||
}
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
data=data
|
||||
)
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(data=data)
|
||||
|
||||
result = compute.list_floating_ip_pools(self.compute_sdk_client)
|
||||
result = compute.list_floating_ip_pools(self.compute_client)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-floating-ip-pools', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(data['floating_ip_pools'], result)
|
||||
|
@ -99,9 +99,7 @@ class TestAvailabilityZoneList(
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.availability_zones.return_value = (
|
||||
self.compute_azs
|
||||
)
|
||||
self.compute_client.availability_zones.return_value = self.compute_azs
|
||||
self.volume_sdk_client.availability_zones.return_value = (
|
||||
self.volume_azs
|
||||
)
|
||||
@ -120,9 +118,7 @@ class TestAvailabilityZoneList(
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.availability_zones.assert_called_with(
|
||||
details=True
|
||||
)
|
||||
self.compute_client.availability_zones.assert_called_with(details=True)
|
||||
self.volume_sdk_client.availability_zones.assert_called_with()
|
||||
self.network_client.availability_zones.assert_called_with()
|
||||
|
||||
@ -150,9 +146,7 @@ class TestAvailabilityZoneList(
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.availability_zones.assert_called_with(
|
||||
details=True
|
||||
)
|
||||
self.compute_client.availability_zones.assert_called_with(details=True)
|
||||
self.volume_sdk_client.availability_zones.assert_called_with()
|
||||
self.network_client.availability_zones.assert_called_with()
|
||||
|
||||
@ -186,9 +180,7 @@ class TestAvailabilityZoneList(
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.availability_zones.assert_called_with(
|
||||
details=True
|
||||
)
|
||||
self.compute_client.availability_zones.assert_called_with(details=True)
|
||||
self.volume_sdk_client.availability_zones.assert_not_called()
|
||||
self.network_client.availability_zones.assert_not_called()
|
||||
|
||||
@ -212,7 +204,7 @@ class TestAvailabilityZoneList(
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.availability_zones.assert_not_called()
|
||||
self.compute_client.availability_zones.assert_not_called()
|
||||
self.volume_sdk_client.availability_zones.assert_called_with()
|
||||
self.network_client.availability_zones.assert_not_called()
|
||||
|
||||
@ -236,7 +228,7 @@ class TestAvailabilityZoneList(
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.availability_zones.assert_not_called()
|
||||
self.compute_client.availability_zones.assert_not_called()
|
||||
self.volume_sdk_client.availability_zones.assert_not_called()
|
||||
self.network_client.availability_zones.assert_called_with()
|
||||
|
||||
|
@ -52,9 +52,7 @@ class TestExtensionList(TestExtension):
|
||||
self.identity_client.extensions.list.return_value = [
|
||||
self.identity_extension
|
||||
]
|
||||
self.compute_sdk_client.extensions.return_value = [
|
||||
self.compute_extension
|
||||
]
|
||||
self.compute_client.extensions.return_value = [self.compute_extension]
|
||||
self.volume_sdk_client.extensions.return_value = [
|
||||
self.volume_extension
|
||||
]
|
||||
@ -106,7 +104,7 @@ class TestExtensionList(TestExtension):
|
||||
)
|
||||
self._test_extension_list_helper(arglist, verifylist, datalist)
|
||||
self.identity_client.extensions.list.assert_called_with()
|
||||
self.compute_sdk_client.extensions.assert_called_with()
|
||||
self.compute_client.extensions.assert_called_with()
|
||||
self.volume_sdk_client.extensions.assert_called_with()
|
||||
self.network_client.extensions.assert_called_with()
|
||||
|
||||
@ -153,7 +151,7 @@ class TestExtensionList(TestExtension):
|
||||
)
|
||||
self._test_extension_list_helper(arglist, verifylist, datalist, True)
|
||||
self.identity_client.extensions.list.assert_called_with()
|
||||
self.compute_sdk_client.extensions.assert_called_with()
|
||||
self.compute_client.extensions.assert_called_with()
|
||||
self.volume_sdk_client.extensions.assert_called_with()
|
||||
self.network_client.extensions.assert_called_with()
|
||||
|
||||
@ -230,7 +228,7 @@ class TestExtensionList(TestExtension):
|
||||
),
|
||||
)
|
||||
self._test_extension_list_helper(arglist, verifylist, datalist)
|
||||
self.compute_sdk_client.extensions.assert_called_with()
|
||||
self.compute_client.extensions.assert_called_with()
|
||||
|
||||
def test_extension_list_compute_and_network(self):
|
||||
arglist = [
|
||||
@ -254,7 +252,7 @@ class TestExtensionList(TestExtension):
|
||||
),
|
||||
)
|
||||
self._test_extension_list_helper(arglist, verifylist, datalist)
|
||||
self.compute_sdk_client.extensions.assert_called_with()
|
||||
self.compute_client.extensions.assert_called_with()
|
||||
self.network_client.extensions.assert_called_with()
|
||||
|
||||
def test_extension_list_volume(self):
|
||||
|
@ -68,7 +68,7 @@ class TestComputeLimits(compute_fakes.TestComputev2):
|
||||
('DELETE', '*', 100, 100, 'MINUTE', '2011-12-15T22:42:45Z'),
|
||||
]
|
||||
|
||||
self.compute_sdk_client.get_limits.return_value = self.fake_limits
|
||||
self.compute_client.get_limits.return_value = self.fake_limits
|
||||
|
||||
def test_compute_show_absolute(self):
|
||||
arglist = ['--absolute']
|
||||
|
@ -98,7 +98,7 @@ class TestQuotaList(TestQuota):
|
||||
_compute_quota_set.QuotaSet
|
||||
)
|
||||
# the defaults are global hence use of return_value here
|
||||
self.compute_sdk_client.get_quota_set_defaults.return_value = (
|
||||
self.compute_client.get_quota_set_defaults.return_value = (
|
||||
self.default_compute_quotas
|
||||
)
|
||||
self.compute_reference_data = (
|
||||
@ -164,7 +164,7 @@ class TestQuotaList(TestQuota):
|
||||
|
||||
def test_quota_list_compute(self):
|
||||
# Two projects with non-default quotas
|
||||
self.compute_sdk_client.get_quota_set.side_effect = self.compute_quotas
|
||||
self.compute_client.get_quota_set.side_effect = self.compute_quotas
|
||||
|
||||
arglist = [
|
||||
'--compute',
|
||||
@ -183,7 +183,7 @@ class TestQuotaList(TestQuota):
|
||||
|
||||
def test_quota_list_compute_default(self):
|
||||
# One of the projects is at defaults
|
||||
self.compute_sdk_client.get_quota_set.side_effect = [
|
||||
self.compute_client.get_quota_set.side_effect = [
|
||||
self.compute_quotas[0],
|
||||
self.default_compute_quotas,
|
||||
]
|
||||
@ -205,7 +205,7 @@ class TestQuotaList(TestQuota):
|
||||
|
||||
def test_quota_list_compute_project_not_found(self):
|
||||
# Make one of the projects disappear
|
||||
self.compute_sdk_client.get_quota_set.side_effect = [
|
||||
self.compute_client.get_quota_set.side_effect = [
|
||||
self.compute_quotas[0],
|
||||
sdk_exceptions.NotFoundException("NotFound"),
|
||||
]
|
||||
@ -227,7 +227,7 @@ class TestQuotaList(TestQuota):
|
||||
|
||||
def test_quota_list_compute_project_inaccessible(self):
|
||||
# Make one of the projects inaccessible
|
||||
self.compute_sdk_client.get_quota_set.side_effect = [
|
||||
self.compute_client.get_quota_set.side_effect = [
|
||||
self.compute_quotas[0],
|
||||
sdk_exceptions.ForbiddenException("Forbidden"),
|
||||
]
|
||||
@ -249,7 +249,7 @@ class TestQuotaList(TestQuota):
|
||||
|
||||
def test_quota_list_compute_server_error(self):
|
||||
# Make the server "break"
|
||||
self.compute_sdk_client.get_quota_set.side_effect = (
|
||||
self.compute_client.get_quota_set.side_effect = (
|
||||
sdk_exceptions.HttpException("Not implemented?")
|
||||
)
|
||||
|
||||
@ -470,7 +470,7 @@ class TestQuotaSet(TestQuota):
|
||||
'server_group_members': servgroup_members_num,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
||||
self.compute_client.update_quota_set.assert_called_once_with(
|
||||
self.projects[0].id, **kwargs
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -744,7 +744,7 @@ class TestQuotaSet(TestQuota):
|
||||
'volumes': volumes,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.update_quota_class_set.assert_called_with(
|
||||
self.compute_client.update_quota_class_set.assert_called_with(
|
||||
self.projects[0].name, **kwargs_compute
|
||||
)
|
||||
self.volume_sdk_client.update_quota_class_set.assert_called_with(
|
||||
@ -842,7 +842,7 @@ class TestQuotaSet(TestQuota):
|
||||
'volumes': volumes,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.update_quota_class_set.assert_called_with(
|
||||
self.compute_client.update_quota_class_set.assert_called_with(
|
||||
'default', **kwargs_compute
|
||||
)
|
||||
self.volume_sdk_client.update_quota_class_set.assert_called_with(
|
||||
@ -899,7 +899,7 @@ class TestQuotaSet(TestQuota):
|
||||
'subnet': subnet,
|
||||
'force': True,
|
||||
}
|
||||
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
||||
self.compute_client.update_quota_set.assert_called_once_with(
|
||||
self.projects[0].id, **kwargs_compute
|
||||
)
|
||||
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
||||
@ -942,7 +942,7 @@ class TestQuotaSet(TestQuota):
|
||||
'subnet': 10,
|
||||
'check_limit': True,
|
||||
}
|
||||
self.compute_sdk_client.update_quota_set.assert_called_once_with(
|
||||
self.compute_client.update_quota_set.assert_called_once_with(
|
||||
self.projects[0].id, **kwargs_compute
|
||||
)
|
||||
self.volume_sdk_client.update_quota_set.assert_called_once_with(
|
||||
@ -977,13 +977,13 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.identity_sdk_client.find_project.return_value = self.projects[0]
|
||||
|
||||
self.compute_sdk_client.get_quota_set.return_value = (
|
||||
self.compute_client.get_quota_set.return_value = (
|
||||
sdk_fakes.generate_fake_resource(_compute_quota_set.QuotaSet)
|
||||
)
|
||||
self.default_compute_quotas = sdk_fakes.generate_fake_resource(
|
||||
_compute_quota_set.QuotaSet
|
||||
)
|
||||
self.compute_sdk_client.get_quota_set_defaults.return_value = (
|
||||
self.compute_client.get_quota_set_defaults.return_value = (
|
||||
self.default_compute_quotas
|
||||
)
|
||||
|
||||
@ -1027,7 +1027,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
||||
self.compute_client.get_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
usage=False,
|
||||
)
|
||||
@ -1054,7 +1054,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
||||
self.compute_client.get_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
usage=False,
|
||||
)
|
||||
@ -1074,7 +1074,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_not_called()
|
||||
self.compute_client.get_quota_set.assert_not_called()
|
||||
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
usage=False,
|
||||
@ -1094,7 +1094,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_not_called()
|
||||
self.compute_client.get_quota_set.assert_not_called()
|
||||
self.volume_sdk_client.get_quota_set.assert_not_called()
|
||||
self.network_client.get_quota.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
@ -1115,7 +1115,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set_defaults.assert_called_once_with(
|
||||
self.compute_client.get_quota_set_defaults.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
)
|
||||
self.volume_sdk_client.get_quota_set_defaults.assert_called_once_with(
|
||||
@ -1139,7 +1139,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
||||
self.compute_client.get_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
usage=True,
|
||||
)
|
||||
@ -1161,7 +1161,7 @@ class TestQuotaShow(TestQuota):
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_quota_set.assert_called_once_with(
|
||||
self.compute_client.get_quota_set.assert_called_once_with(
|
||||
self.projects[1].id, usage=False
|
||||
)
|
||||
self.volume_sdk_client.get_quota_set.assert_called_once_with(
|
||||
@ -1181,7 +1181,7 @@ class TestQuotaDelete(TestQuota):
|
||||
|
||||
self.identity_sdk_client.find_project.return_value = self.projects[0]
|
||||
|
||||
self.compute_sdk_client.revert_quota_set.return_value = None
|
||||
self.compute_client.revert_quota_set.return_value = None
|
||||
self.volume_sdk_client.revert_quota_set.return_value = None
|
||||
self.network_client.delete_quota.return_value = None
|
||||
|
||||
@ -1205,7 +1205,7 @@ class TestQuotaDelete(TestQuota):
|
||||
self.identity_sdk_client.find_project.assert_called_once_with(
|
||||
self.projects[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.revert_quota_set.assert_called_once_with(
|
||||
self.compute_client.revert_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
)
|
||||
self.volume_sdk_client.revert_quota_set.assert_called_once_with(
|
||||
@ -1234,7 +1234,7 @@ class TestQuotaDelete(TestQuota):
|
||||
self.identity_sdk_client.find_project.assert_called_once_with(
|
||||
self.projects[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.revert_quota_set.assert_called_once_with(
|
||||
self.compute_client.revert_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
)
|
||||
self.volume_sdk_client.revert_quota_set.assert_not_called()
|
||||
@ -1259,7 +1259,7 @@ class TestQuotaDelete(TestQuota):
|
||||
self.identity_sdk_client.find_project.assert_called_once_with(
|
||||
self.projects[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.revert_quota_set.assert_not_called()
|
||||
self.compute_client.revert_quota_set.assert_not_called()
|
||||
self.volume_sdk_client.revert_quota_set.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
)
|
||||
@ -1284,7 +1284,7 @@ class TestQuotaDelete(TestQuota):
|
||||
self.identity_sdk_client.find_project.assert_called_once_with(
|
||||
self.projects[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.revert_quota_set.assert_not_called()
|
||||
self.compute_client.revert_quota_set.assert_not_called()
|
||||
self.volume_sdk_client.revert_quota_set.assert_not_called()
|
||||
self.network_client.delete_quota.assert_called_once_with(
|
||||
self.projects[0].id,
|
||||
|
@ -98,10 +98,8 @@ class FakeClientMixin:
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
# TODO(stephenfin): Rename to 'compute_client' once all commands are
|
||||
# migrated to SDK
|
||||
self.app.client_manager.compute = mock.Mock(_proxy.Proxy)
|
||||
self.compute_sdk_client = self.app.client_manager.compute
|
||||
self.compute_client = self.app.client_manager.compute
|
||||
self.set_compute_api_version() # default to the lowest
|
||||
|
||||
def set_compute_api_version(self, version: str = '2.1'):
|
||||
@ -113,8 +111,8 @@ class FakeClientMixin:
|
||||
"""
|
||||
assert re.match(r'2.\d+', version)
|
||||
|
||||
self.compute_sdk_client.default_microversion = version
|
||||
self.compute_sdk_client.get_endpoint_data.return_value = (
|
||||
self.compute_client.default_microversion = version
|
||||
self.compute_client.get_endpoint_data.return_value = (
|
||||
discover.EndpointData(
|
||||
min_microversion='2.1', # nova has not bumped this yet
|
||||
max_microversion=version,
|
||||
|
@ -61,7 +61,7 @@ class TestAgentCreate(compute_fakes.TestComputev2):
|
||||
self._agent['version'],
|
||||
)
|
||||
|
||||
self.compute_sdk_client.post.return_value = fakes.FakeResponse(
|
||||
self.compute_client.post.return_value = fakes.FakeResponse(
|
||||
data={'agent': self._agent}
|
||||
)
|
||||
self.cmd = agent.CreateAgent(self.app, None)
|
||||
@ -87,7 +87,7 @@ class TestAgentCreate(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.post.assert_called_with(
|
||||
self.compute_client.post.assert_called_with(
|
||||
'/os-agents',
|
||||
json={
|
||||
'agent': {
|
||||
@ -110,7 +110,7 @@ class TestAgentDelete(compute_fakes.TestComputev2):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.delete.return_value = fakes.FakeResponse(
|
||||
self.compute_client.delete.return_value = fakes.FakeResponse(
|
||||
status_code=http.HTTPStatus.NO_CONTENT
|
||||
)
|
||||
|
||||
@ -125,7 +125,7 @@ class TestAgentDelete(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.delete.assert_called_once_with(
|
||||
self.compute_client.delete.assert_called_once_with(
|
||||
'/os-agents/123',
|
||||
microversion='2.1',
|
||||
)
|
||||
@ -143,7 +143,7 @@ class TestAgentDelete(compute_fakes.TestComputev2):
|
||||
calls = [
|
||||
mock.call(f'/os-agents/{x}', microversion='2.1') for x in arglist
|
||||
]
|
||||
self.compute_sdk_client.delete.assert_has_calls(calls)
|
||||
self.compute_client.delete.assert_has_calls(calls)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_delete_multiple_agents_exception(self):
|
||||
@ -154,7 +154,7 @@ class TestAgentDelete(compute_fakes.TestComputev2):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.delete.side_effect = [
|
||||
self.compute_client.delete.side_effect = [
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NO_CONTENT),
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NO_CONTENT),
|
||||
fakes.FakeResponse(status_code=http.HTTPStatus.NOT_FOUND),
|
||||
@ -166,7 +166,7 @@ class TestAgentDelete(compute_fakes.TestComputev2):
|
||||
calls = [
|
||||
mock.call(f'/os-agents/{x}', microversion='2.1') for x in arglist
|
||||
]
|
||||
self.compute_sdk_client.delete.assert_has_calls(calls)
|
||||
self.compute_client.delete.assert_has_calls(calls)
|
||||
|
||||
def test_agent_delete_no_input(self):
|
||||
arglist = []
|
||||
@ -208,7 +208,7 @@ class TestAgentList(compute_fakes.TestComputev2):
|
||||
for _agent in _agents
|
||||
]
|
||||
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(
|
||||
data={'agents': _agents},
|
||||
)
|
||||
self.cmd = agent.ListAgent(self.app, None)
|
||||
@ -222,7 +222,7 @@ class TestAgentList(compute_fakes.TestComputev2):
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, list(data))
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-agents',
|
||||
microversion='2.1',
|
||||
)
|
||||
@ -241,7 +241,7 @@ class TestAgentList(compute_fakes.TestComputev2):
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, list(data))
|
||||
self.compute_sdk_client.get.assert_called_once_with(
|
||||
self.compute_client.get.assert_called_once_with(
|
||||
'/os-agents?hypervisor=hypervisor',
|
||||
microversion='2.1',
|
||||
)
|
||||
@ -252,10 +252,10 @@ class TestAgentSet(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self.agent = _generate_fake_agent()
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(
|
||||
data={'agents': [self.agent]},
|
||||
)
|
||||
self.compute_sdk_client.put.return_value = fakes.FakeResponse()
|
||||
self.compute_client.put.return_value = fakes.FakeResponse()
|
||||
|
||||
self.cmd = agent.SetAgent(self.app, None)
|
||||
|
||||
@ -269,7 +269,7 @@ class TestAgentSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.put.assert_called_once_with(
|
||||
self.compute_client.put.assert_called_once_with(
|
||||
f'/os-agents/{self.agent["agent_id"]}',
|
||||
json={
|
||||
'para': {
|
||||
@ -297,7 +297,7 @@ class TestAgentSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.put.assert_called_once_with(
|
||||
self.compute_client.put.assert_called_once_with(
|
||||
f'/os-agents/{self.agent["agent_id"]}',
|
||||
json={
|
||||
'para': {
|
||||
@ -325,7 +325,7 @@ class TestAgentSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.put.assert_called_once_with(
|
||||
self.compute_client.put.assert_called_once_with(
|
||||
f'/os-agents/{self.agent["agent_id"]}',
|
||||
json={
|
||||
'para': {
|
||||
@ -353,7 +353,7 @@ class TestAgentSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.put.assert_called_once_with(
|
||||
self.compute_client.put.assert_called_once_with(
|
||||
f'/os-agents/{self.agent["agent_id"]}',
|
||||
json={
|
||||
'para': {
|
||||
|
@ -66,10 +66,8 @@ class TestAggregateAddHost(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_sdk_client.add_host_to_aggregate.return_value = (
|
||||
self.fake_ag
|
||||
)
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.add_host_to_aggregate.return_value = self.fake_ag
|
||||
self.cmd = aggregate.AddAggregateHost(self.app, None)
|
||||
|
||||
def test_aggregate_add_host(self):
|
||||
@ -83,10 +81,10 @@ class TestAggregateAddHost(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.add_host_to_aggregate.assert_called_once_with(
|
||||
self.compute_client.add_host_to_aggregate.assert_called_once_with(
|
||||
self.fake_ag.id, parsed_args.host
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -97,10 +95,8 @@ class TestAggregateCreate(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.create_aggregate.return_value = self.fake_ag
|
||||
self.compute_sdk_client.set_aggregate_metadata.return_value = (
|
||||
self.fake_ag
|
||||
)
|
||||
self.compute_client.create_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.set_aggregate_metadata.return_value = self.fake_ag
|
||||
self.cmd = aggregate.CreateAggregate(self.app, None)
|
||||
|
||||
def test_aggregate_create(self):
|
||||
@ -112,7 +108,7 @@ class TestAggregateCreate(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_aggregate.assert_called_once_with(
|
||||
self.compute_client.create_aggregate.assert_called_once_with(
|
||||
name=parsed_args.name
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -131,7 +127,7 @@ class TestAggregateCreate(TestAggregate):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_aggregate.assert_called_once_with(
|
||||
self.compute_client.create_aggregate.assert_called_once_with(
|
||||
name=parsed_args.name, availability_zone=parsed_args.zone
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -151,10 +147,10 @@ class TestAggregateCreate(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_aggregate.assert_called_once_with(
|
||||
self.compute_client.create_aggregate.assert_called_once_with(
|
||||
name=parsed_args.name
|
||||
)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, parsed_args.properties
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -169,7 +165,7 @@ class TestAggregateDelete(TestAggregate):
|
||||
sdk_fakes.generate_fake_resources(_aggregate.Aggregate, 2)
|
||||
)
|
||||
|
||||
self.compute_sdk_client.find_aggregate = mock.Mock(
|
||||
self.compute_client.find_aggregate = mock.Mock(
|
||||
side_effect=[self.fake_ags[0], self.fake_ags[1]]
|
||||
)
|
||||
self.cmd = aggregate.DeleteAggregate(self.app, None)
|
||||
@ -181,10 +177,10 @@ class TestAggregateDelete(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
self.fake_ags[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_aggregate.assert_called_once_with(
|
||||
self.compute_client.delete_aggregate.assert_called_once_with(
|
||||
self.fake_ags[0].id, ignore_missing=False
|
||||
)
|
||||
|
||||
@ -202,8 +198,8 @@ class TestAggregateDelete(TestAggregate):
|
||||
calls = []
|
||||
for a in self.fake_ags:
|
||||
calls.append(call(a.id, ignore_missing=False))
|
||||
self.compute_sdk_client.find_aggregate.assert_has_calls(calls)
|
||||
self.compute_sdk_client.delete_aggregate.assert_has_calls(calls)
|
||||
self.compute_client.find_aggregate.assert_has_calls(calls)
|
||||
self.compute_client.delete_aggregate.assert_has_calls(calls)
|
||||
|
||||
def test_delete_multiple_agggregates_with_exception(self):
|
||||
arglist = [
|
||||
@ -216,7 +212,7 @@ class TestAggregateDelete(TestAggregate):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.find_aggregate.side_effect = [
|
||||
self.compute_client.find_aggregate.side_effect = [
|
||||
self.fake_ags[0],
|
||||
sdk_exceptions.NotFoundException,
|
||||
]
|
||||
@ -229,8 +225,8 @@ class TestAggregateDelete(TestAggregate):
|
||||
calls = []
|
||||
for a in arglist:
|
||||
calls.append(call(a, ignore_missing=False))
|
||||
self.compute_sdk_client.find_aggregate.assert_has_calls(calls)
|
||||
self.compute_sdk_client.delete_aggregate.assert_called_with(
|
||||
self.compute_client.find_aggregate.assert_has_calls(calls)
|
||||
self.compute_client.delete_aggregate.assert_called_with(
|
||||
self.fake_ags[0].id, ignore_missing=False
|
||||
)
|
||||
|
||||
@ -239,7 +235,7 @@ class TestAggregateList(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.aggregates.return_value = [self.fake_ag]
|
||||
self.compute_client.aggregates.return_value = [self.fake_ag]
|
||||
self.cmd = aggregate.ListAggregate(self.app, None)
|
||||
|
||||
def test_aggregate_list(self):
|
||||
@ -333,8 +329,8 @@ class TestAggregateRemoveHost(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_sdk_client.remove_host_from_aggregate.return_value = (
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.remove_host_from_aggregate.return_value = (
|
||||
self.fake_ag
|
||||
)
|
||||
self.cmd = aggregate.RemoveAggregateHost(self.app, None)
|
||||
@ -350,10 +346,10 @@ class TestAggregateRemoveHost(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.remove_host_from_aggregate.assert_called_once_with(
|
||||
self.compute_client.remove_host_from_aggregate.assert_called_once_with(
|
||||
self.fake_ag.id, parsed_args.host
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -364,7 +360,7 @@ class TestAggregateSet(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.cmd = aggregate.SetAggregate(self.app, None)
|
||||
|
||||
def test_aggregate_set_no_option(self):
|
||||
@ -377,11 +373,11 @@ class TestAggregateSet(TestAggregate):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.update_aggregate)
|
||||
self.assertNotCalled(self.compute_sdk_client.set_aggregate_metadata)
|
||||
self.assertNotCalled(self.compute_client.update_aggregate)
|
||||
self.assertNotCalled(self.compute_client.set_aggregate_metadata)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_aggregate_set_with_name(self):
|
||||
@ -397,13 +393,13 @@ class TestAggregateSet(TestAggregate):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.update_aggregate.assert_called_once_with(
|
||||
self.compute_client.update_aggregate.assert_called_once_with(
|
||||
self.fake_ag.id, name=parsed_args.name
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.set_aggregate_metadata)
|
||||
self.assertNotCalled(self.compute_client.set_aggregate_metadata)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_aggregate_set_with_zone(self):
|
||||
@ -419,13 +415,13 @@ class TestAggregateSet(TestAggregate):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.update_aggregate.assert_called_once_with(
|
||||
self.compute_client.update_aggregate.assert_called_once_with(
|
||||
self.fake_ag.id, availability_zone=parsed_args.zone
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.set_aggregate_metadata)
|
||||
self.assertNotCalled(self.compute_client.set_aggregate_metadata)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_aggregate_set_with_property(self):
|
||||
@ -443,11 +439,11 @@ class TestAggregateSet(TestAggregate):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.update_aggregate)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.assertNotCalled(self.compute_client.update_aggregate)
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, parsed_args.properties
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -466,11 +462,11 @@ class TestAggregateSet(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.update_aggregate)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.assertNotCalled(self.compute_client.update_aggregate)
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, {'key1': None, 'key2': 'value2'}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -486,11 +482,11 @@ class TestAggregateSet(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.update_aggregate)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.assertNotCalled(self.compute_client.update_aggregate)
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, {'key1': None}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -509,13 +505,13 @@ class TestAggregateSet(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.update_aggregate.assert_called_once_with(
|
||||
self.compute_client.update_aggregate.assert_called_once_with(
|
||||
self.fake_ag.id, availability_zone=parsed_args.zone
|
||||
)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, {'key1': None}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -538,7 +534,7 @@ class TestAggregateShow(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.cmd = aggregate.ShowAggregate(self.app, None)
|
||||
|
||||
self.data = (
|
||||
@ -563,7 +559,7 @@ class TestAggregateShow(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
|
||||
@ -575,7 +571,7 @@ class TestAggregateUnset(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.cmd = aggregate.UnsetAggregate(self.app, None)
|
||||
|
||||
def test_aggregate_unset(self):
|
||||
@ -591,7 +587,7 @@ class TestAggregateUnset(TestAggregate):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, {'unset_key': None}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -611,7 +607,7 @@ class TestAggregateUnset(TestAggregate):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.compute_client.set_aggregate_metadata.assert_called_once_with(
|
||||
self.fake_ag.id, {'unset_key1': None, 'unset_key2': None}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -626,7 +622,7 @@ class TestAggregateUnset(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertNotCalled(self.compute_sdk_client.set_aggregate_metadata)
|
||||
self.assertNotCalled(self.compute_client.set_aggregate_metadata)
|
||||
self.assertIsNone(result)
|
||||
|
||||
|
||||
@ -636,7 +632,7 @@ class TestAggregateCacheImage(TestAggregate):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_aggregate.return_value = self.fake_ag
|
||||
self.compute_client.find_aggregate.return_value = self.fake_ag
|
||||
self.find_image_mock = mock.Mock(side_effect=self.images)
|
||||
self.app.client_manager.sdk_connection.image.find_image = (
|
||||
self.find_image_mock
|
||||
@ -667,10 +663,10 @@ class TestAggregateCacheImage(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.aggregate_precache_images.assert_called_once_with(
|
||||
self.compute_client.aggregate_precache_images.assert_called_once_with(
|
||||
self.fake_ag.id, [self.images[0].id]
|
||||
)
|
||||
|
||||
@ -688,9 +684,9 @@ class TestAggregateCacheImage(TestAggregate):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_aggregate.assert_called_once_with(
|
||||
self.compute_client.find_aggregate.assert_called_once_with(
|
||||
parsed_args.aggregate, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.aggregate_precache_images.assert_called_once_with(
|
||||
self.compute_client.aggregate_precache_images.assert_called_once_with(
|
||||
self.fake_ag.id, [self.images[0].id, self.images[1].id]
|
||||
)
|
||||
|
@ -28,7 +28,7 @@ class TestConsoleLog(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self._server = sdk_fakes.generate_fake_resource(_server.Server)
|
||||
self.compute_sdk_client.find_server.return_value = self._server
|
||||
self.compute_client.find_server.return_value = self._server
|
||||
|
||||
self.cmd = console.ShowConsoleLog(self.app, None)
|
||||
|
||||
@ -49,13 +49,13 @@ class TestConsoleLog(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
output = {'output': '1st line\n2nd line\n'}
|
||||
self.compute_sdk_client.get_server_console_output.return_value = output
|
||||
self.compute_client.get_server_console_output.return_value = output
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
name_or_id='fake_server', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.get_server_console_output.assert_called_with(
|
||||
self.compute_client.get_server_console_output.assert_called_with(
|
||||
self._server.id, length=None
|
||||
)
|
||||
stdout = self.app.stdout.content
|
||||
@ -67,13 +67,13 @@ class TestConsoleLog(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
output = {'output': '1st line\n2nd line'}
|
||||
self.compute_sdk_client.get_server_console_output.return_value = output
|
||||
self.compute_client.get_server_console_output.return_value = output
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
name_or_id='fake_server', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.get_server_console_output.assert_called_with(
|
||||
self.compute_client.get_server_console_output.assert_called_with(
|
||||
self._server.id, length=15
|
||||
)
|
||||
|
||||
@ -83,14 +83,14 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self._server = sdk_fakes.generate_fake_resource(_server.Server)
|
||||
self.compute_sdk_client.find_server.return_value = self._server
|
||||
self.compute_client.find_server.return_value = self._server
|
||||
|
||||
fake_console_data = {
|
||||
'url': 'http://localhost',
|
||||
'protocol': 'fake_protocol',
|
||||
'type': 'fake_type',
|
||||
}
|
||||
self.compute_sdk_client.create_console = mock.Mock(
|
||||
self.compute_client.create_console = mock.Mock(
|
||||
return_value=fake_console_data
|
||||
)
|
||||
|
||||
@ -117,7 +117,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='novnc'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -134,7 +134,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='novnc'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -151,7 +151,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='xvpvnc'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -168,7 +168,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='spice-html5'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -185,7 +185,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='rdp-html5'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -202,7 +202,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='serial'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -219,7 +219,7 @@ class TestConsoleUrlShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_console.assert_called_once_with(
|
||||
self.compute_client.create_console.assert_called_once_with(
|
||||
self._server.id, console_type='webmks'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
|
@ -86,7 +86,7 @@ class TestFlavorCreate(TestFlavor):
|
||||
|
||||
# Return a project
|
||||
self.projects_mock.get.return_value = self.project
|
||||
self.compute_sdk_client.create_flavor.return_value = self.flavor
|
||||
self.compute_client.create_flavor.return_value = self.flavor
|
||||
self.cmd = flavor.CreateFlavor(self.app, None)
|
||||
|
||||
def test_flavor_create_default_options(self):
|
||||
@ -109,7 +109,7 @@ class TestFlavorCreate(TestFlavor):
|
||||
}
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_flavor.assert_called_once_with(
|
||||
self.compute_client.create_flavor.assert_called_once_with(
|
||||
**default_args
|
||||
)
|
||||
|
||||
@ -180,17 +180,17 @@ class TestFlavorCreate(TestFlavor):
|
||||
# convert expected data tuple to list to be able to modify it
|
||||
cmp_data = list(self.data)
|
||||
cmp_data[7] = format_columns.DictColumn(props)
|
||||
self.compute_sdk_client.create_flavor.return_value = create_flavor
|
||||
self.compute_sdk_client.create_flavor_extra_specs.return_value = (
|
||||
self.compute_client.create_flavor.return_value = create_flavor
|
||||
self.compute_client.create_flavor_extra_specs.return_value = (
|
||||
expected_flavor
|
||||
)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_flavor.assert_called_once_with(**args)
|
||||
self.compute_sdk_client.create_flavor_extra_specs.assert_called_once_with(
|
||||
self.compute_client.create_flavor.assert_called_once_with(**args)
|
||||
self.compute_client.create_flavor_extra_specs.assert_called_once_with(
|
||||
create_flavor, props
|
||||
)
|
||||
self.compute_sdk_client.get_flavor_access.assert_not_called()
|
||||
self.compute_client.get_flavor_access.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(tuple(cmp_data), data)
|
||||
@ -265,19 +265,19 @@ class TestFlavorCreate(TestFlavor):
|
||||
# convert expected data tuple to list to be able to modify it
|
||||
cmp_data = list(self.data_private)
|
||||
cmp_data[7] = format_columns.DictColumn(props)
|
||||
self.compute_sdk_client.create_flavor.return_value = create_flavor
|
||||
self.compute_sdk_client.create_flavor_extra_specs.return_value = (
|
||||
self.compute_client.create_flavor.return_value = create_flavor
|
||||
self.compute_client.create_flavor_extra_specs.return_value = (
|
||||
expected_flavor
|
||||
)
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_flavor.assert_called_once_with(**args)
|
||||
self.compute_sdk_client.flavor_add_tenant_access.assert_called_with(
|
||||
self.compute_client.create_flavor.assert_called_once_with(**args)
|
||||
self.compute_client.flavor_add_tenant_access.assert_called_with(
|
||||
self.flavor.id,
|
||||
self.project.id,
|
||||
)
|
||||
self.compute_sdk_client.create_flavor_extra_specs.assert_called_with(
|
||||
self.compute_client.create_flavor_extra_specs.assert_called_with(
|
||||
create_flavor, props
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -362,7 +362,7 @@ class TestFlavorCreate(TestFlavor):
|
||||
'description': 'fake description',
|
||||
}
|
||||
|
||||
self.compute_sdk_client.create_flavor.assert_called_once_with(**args)
|
||||
self.compute_client.create_flavor.assert_called_once_with(**args)
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(self.data_private, data)
|
||||
@ -400,7 +400,7 @@ class TestFlavorDelete(TestFlavor):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.delete_flavor.return_value = None
|
||||
self.compute_client.delete_flavor.return_value = None
|
||||
|
||||
self.cmd = flavor.DeleteFlavor(self.app, None)
|
||||
|
||||
@ -411,14 +411,14 @@ class TestFlavorDelete(TestFlavor):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.find_flavor.return_value = self.flavors[0]
|
||||
self.compute_client.find_flavor.return_value = self.flavors[0]
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
self.flavors[0].id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_flavor.assert_called_with(
|
||||
self.compute_client.delete_flavor.assert_called_with(
|
||||
self.flavors[0].id
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -433,7 +433,7 @@ class TestFlavorDelete(TestFlavor):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.find_flavor.side_effect = self.flavors
|
||||
self.compute_client.find_flavor.side_effect = self.flavors
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
@ -441,8 +441,8 @@ class TestFlavorDelete(TestFlavor):
|
||||
mock.call(i.id, ignore_missing=False) for i in self.flavors
|
||||
]
|
||||
delete_calls = [mock.call(i.id) for i in self.flavors]
|
||||
self.compute_sdk_client.find_flavor.assert_has_calls(find_calls)
|
||||
self.compute_sdk_client.delete_flavor.assert_has_calls(delete_calls)
|
||||
self.compute_client.find_flavor.assert_has_calls(find_calls)
|
||||
self.compute_client.delete_flavor.assert_has_calls(delete_calls)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_multi_flavors_delete_with_exception(self):
|
||||
@ -453,7 +453,7 @@ class TestFlavorDelete(TestFlavor):
|
||||
verifylist = [('flavor', [self.flavors[0].id, 'unexist_flavor'])]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.find_flavor.side_effect = [
|
||||
self.compute_client.find_flavor.side_effect = [
|
||||
self.flavors[0],
|
||||
sdk_exceptions.ResourceNotFound,
|
||||
]
|
||||
@ -469,8 +469,8 @@ class TestFlavorDelete(TestFlavor):
|
||||
mock.call('unexist_flavor', ignore_missing=False),
|
||||
]
|
||||
delete_calls = [mock.call(self.flavors[0].id)]
|
||||
self.compute_sdk_client.find_flavor.assert_has_calls(find_calls)
|
||||
self.compute_sdk_client.delete_flavor.assert_has_calls(delete_calls)
|
||||
self.compute_client.find_flavor.assert_has_calls(find_calls)
|
||||
self.compute_client.delete_flavor.assert_has_calls(delete_calls)
|
||||
|
||||
|
||||
class TestFlavorList(TestFlavor):
|
||||
@ -516,7 +516,7 @@ class TestFlavorList(TestFlavor):
|
||||
[],
|
||||
]
|
||||
|
||||
self.compute_sdk_client.flavors = self.api_mock
|
||||
self.compute_client.flavors = self.api_mock
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = flavor.ListFlavor(self.app, None)
|
||||
@ -541,8 +541,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': True,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, tuple(data))
|
||||
@ -567,8 +567,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': None,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, tuple(data))
|
||||
@ -593,8 +593,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': False,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, tuple(data))
|
||||
@ -619,8 +619,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': True,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, tuple(data))
|
||||
@ -645,8 +645,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': True,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns_long, columns)
|
||||
self.assertCountEqual(self.data_long, tuple(data))
|
||||
@ -678,8 +678,8 @@ class TestFlavorList(TestFlavor):
|
||||
[],
|
||||
]
|
||||
|
||||
self.compute_sdk_client.flavors = self.api_mock
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs = mock.Mock(
|
||||
self.compute_client.flavors = self.api_mock
|
||||
self.compute_client.fetch_flavor_extra_specs = mock.Mock(
|
||||
return_value=None
|
||||
)
|
||||
|
||||
@ -702,8 +702,8 @@ class TestFlavorList(TestFlavor):
|
||||
'is_public': True,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_called_once_with(
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_called_once_with(
|
||||
flavor
|
||||
)
|
||||
|
||||
@ -736,15 +736,15 @@ class TestFlavorList(TestFlavor):
|
||||
'min_ram': 2048,
|
||||
}
|
||||
|
||||
self.compute_sdk_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_sdk_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.flavors.assert_called_with(**kwargs)
|
||||
self.compute_client.fetch_flavor_extra_specs.assert_not_called()
|
||||
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
|
||||
|
||||
class TestFlavorSet(TestFlavor):
|
||||
# Return value of self.compute_sdk_client.find_flavor().
|
||||
# Return value of self.compute_client.find_flavor().
|
||||
flavor = compute_fakes.create_one_flavor(
|
||||
attrs={'os-flavor-access:is_public': False}
|
||||
)
|
||||
@ -753,7 +753,7 @@ class TestFlavorSet(TestFlavor):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
||||
self.compute_client.find_flavor.return_value = self.flavor
|
||||
# Return a project
|
||||
self.projects_mock.get.return_value = self.project
|
||||
self.cmd = flavor.SetFlavor(self.app, None)
|
||||
@ -767,10 +767,10 @@ class TestFlavorSet(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.create_flavor_extra_specs.assert_called_with(
|
||||
self.compute_client.create_flavor_extra_specs.assert_called_with(
|
||||
self.flavor.id, {'FOO': '"B A R"'}
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -781,10 +781,10 @@ class TestFlavorSet(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_flavor_extra_specs_property.assert_called_with(
|
||||
self.compute_client.delete_flavor_extra_specs_property.assert_called_with(
|
||||
self.flavor.id, 'property'
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -803,14 +803,14 @@ class TestFlavorSet(TestFlavor):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.flavor_add_tenant_access.assert_called_with(
|
||||
self.compute_client.flavor_add_tenant_access.assert_called_with(
|
||||
self.flavor.id,
|
||||
self.project.id,
|
||||
)
|
||||
self.compute_sdk_client.create_flavor_extra_specs.assert_not_called()
|
||||
self.compute_client.create_flavor_extra_specs.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_flavor_set_no_project(self):
|
||||
@ -847,7 +847,7 @@ class TestFlavorSet(TestFlavor):
|
||||
)
|
||||
|
||||
def test_flavor_set_with_unexist_flavor(self):
|
||||
self.compute_sdk_client.find_flavor.side_effect = [
|
||||
self.compute_client.find_flavor.side_effect = [
|
||||
sdk_exceptions.ResourceNotFound()
|
||||
]
|
||||
|
||||
@ -876,10 +876,10 @@ class TestFlavorSet(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.flavor_add_tenant_access.assert_not_called()
|
||||
self.compute_client.flavor_add_tenant_access.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_flavor_set_description(self):
|
||||
@ -897,7 +897,7 @@ class TestFlavorSet(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.update_flavor.assert_called_with(
|
||||
self.compute_client.update_flavor.assert_called_with(
|
||||
flavor=self.flavor.id, description='description'
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -935,7 +935,7 @@ class TestFlavorSet(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.update_flavor.assert_called_with(
|
||||
self.compute_client.update_flavor.assert_called_with(
|
||||
flavor=self.flavor.id, description='description'
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -960,7 +960,7 @@ class TestFlavorSet(TestFlavor):
|
||||
|
||||
|
||||
class TestFlavorShow(TestFlavor):
|
||||
# Return value of self.compute_sdk_client.find_flavor().
|
||||
# Return value of self.compute_client.find_flavor().
|
||||
flavor_access = compute_fakes.create_one_flavor_access()
|
||||
flavor = compute_fakes.create_one_flavor()
|
||||
|
||||
@ -1000,8 +1000,8 @@ class TestFlavorShow(TestFlavor):
|
||||
super().setUp()
|
||||
|
||||
# Return value of _find_resource()
|
||||
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
||||
self.compute_sdk_client.get_flavor_access.return_value = [
|
||||
self.compute_client.find_flavor.return_value = self.flavor
|
||||
self.compute_client.get_flavor_access.return_value = [
|
||||
self.flavor_access
|
||||
]
|
||||
self.cmd = flavor.ShowFlavor(self.app, None)
|
||||
@ -1040,7 +1040,7 @@ class TestFlavorShow(TestFlavor):
|
||||
'os-flavor-access:is_public': False,
|
||||
}
|
||||
)
|
||||
self.compute_sdk_client.find_flavor.return_value = private_flavor
|
||||
self.compute_client.find_flavor.return_value = private_flavor
|
||||
|
||||
arglist = [
|
||||
private_flavor.name,
|
||||
@ -1069,7 +1069,7 @@ class TestFlavorShow(TestFlavor):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_flavor_access.assert_called_with(
|
||||
self.compute_client.get_flavor_access.assert_called_with(
|
||||
flavor=private_flavor.id
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -1077,7 +1077,7 @@ class TestFlavorShow(TestFlavor):
|
||||
|
||||
|
||||
class TestFlavorUnset(TestFlavor):
|
||||
# Return value of self.compute_sdk_client.find_flavor().
|
||||
# Return value of self.compute_client.find_flavor().
|
||||
flavor = compute_fakes.create_one_flavor(
|
||||
attrs={'os-flavor-access:is_public': False}
|
||||
)
|
||||
@ -1086,13 +1086,13 @@ class TestFlavorUnset(TestFlavor):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_flavor.return_value = self.flavor
|
||||
self.compute_client.find_flavor.return_value = self.flavor
|
||||
# Return a project
|
||||
self.projects_mock.get.return_value = self.project
|
||||
self.cmd = flavor.UnsetFlavor(self.app, None)
|
||||
|
||||
self.mock_shortcut = (
|
||||
self.compute_sdk_client.delete_flavor_extra_specs_property
|
||||
self.compute_client.delete_flavor_extra_specs_property
|
||||
)
|
||||
|
||||
def test_flavor_unset_property(self):
|
||||
@ -1104,11 +1104,11 @@ class TestFlavorUnset(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.mock_shortcut.assert_called_with(self.flavor.id, 'property')
|
||||
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
||||
self.compute_client.flavor_remove_tenant_access.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_flavor_unset_properties(self):
|
||||
@ -1126,7 +1126,7 @@ class TestFlavorUnset(TestFlavor):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
calls = [
|
||||
@ -1141,7 +1141,7 @@ class TestFlavorUnset(TestFlavor):
|
||||
AssertionError, self.mock_shortcut.assert_has_calls, calls
|
||||
)
|
||||
|
||||
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
||||
self.compute_client.flavor_remove_tenant_access.assert_not_called()
|
||||
|
||||
def test_flavor_unset_project(self):
|
||||
arglist = [
|
||||
@ -1158,14 +1158,14 @@ class TestFlavorUnset(TestFlavor):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertIsNone(result)
|
||||
|
||||
self.compute_sdk_client.find_flavor.assert_called_with(
|
||||
self.compute_client.find_flavor.assert_called_with(
|
||||
parsed_args.flavor, get_extra_specs=True, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.flavor_remove_tenant_access.assert_called_with(
|
||||
self.compute_client.flavor_remove_tenant_access.assert_called_with(
|
||||
self.flavor.id,
|
||||
self.project.id,
|
||||
)
|
||||
self.compute_sdk_client.delete_flavor_extra_specs_property.assert_not_called()
|
||||
self.compute_client.delete_flavor_extra_specs_property.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_flavor_unset_no_project(self):
|
||||
@ -1202,7 +1202,7 @@ class TestFlavorUnset(TestFlavor):
|
||||
)
|
||||
|
||||
def test_flavor_unset_with_unexist_flavor(self):
|
||||
self.compute_sdk_client.find_flavor.side_effect = [
|
||||
self.compute_client.find_flavor.side_effect = [
|
||||
sdk_exceptions.ResourceNotFound
|
||||
]
|
||||
|
||||
@ -1232,4 +1232,4 @@ class TestFlavorUnset(TestFlavor):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertIsNone(result)
|
||||
|
||||
self.compute_sdk_client.flavor_remove_tenant_access.assert_not_called()
|
||||
self.compute_client.flavor_remove_tenant_access.assert_not_called()
|
||||
|
@ -72,7 +72,7 @@ class TestHostList(compute_fakes.TestComputev2):
|
||||
)
|
||||
]
|
||||
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(
|
||||
data={'hosts': [self._host]}
|
||||
)
|
||||
self.cmd = host.ListHost(self.app, None)
|
||||
@ -85,7 +85,7 @@ class TestHostList(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_with(
|
||||
self.compute_client.get.assert_called_with(
|
||||
'/os-hosts', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -104,7 +104,7 @@ class TestHostList(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_with(
|
||||
self.compute_client.get.assert_called_with(
|
||||
'/os-hosts', microversion='2.1'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -116,7 +116,7 @@ class TestHostSet(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self._host = _generate_fake_host()
|
||||
self.compute_sdk_client.put.return_value = fakes.FakeResponse()
|
||||
self.compute_client.put.return_value = fakes.FakeResponse()
|
||||
|
||||
self.cmd = host.SetHost(self.app, None)
|
||||
|
||||
@ -132,7 +132,7 @@ class TestHostSet(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertIsNone(result)
|
||||
self.compute_sdk_client.put.assert_not_called()
|
||||
self.compute_client.put.assert_not_called()
|
||||
|
||||
def test_host_set(self):
|
||||
arglist = [
|
||||
@ -150,7 +150,7 @@ class TestHostSet(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.assertIsNone(result)
|
||||
self.compute_sdk_client.put.assert_called_with(
|
||||
self.compute_client.put.assert_called_with(
|
||||
f'/os-hosts/{self._host["host"]}',
|
||||
json={
|
||||
'maintenance_mode': 'disable',
|
||||
@ -183,7 +183,7 @@ class TestHostShow(compute_fakes.TestComputev2):
|
||||
)
|
||||
]
|
||||
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(
|
||||
data={
|
||||
'host': [
|
||||
{
|
||||
@ -226,7 +226,7 @@ class TestHostShow(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get.assert_called_with(
|
||||
self.compute_client.get.assert_called_with(
|
||||
'/os-hosts/' + self._host['host_name'], microversion='2.1'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
|
@ -32,9 +32,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
self.hypervisors = list(
|
||||
sdk_fakes.generate_fake_resources(_hypervisor.Hypervisor, count=2)
|
||||
)
|
||||
self.compute_sdk_client.hypervisors.return_value = iter(
|
||||
self.hypervisors
|
||||
)
|
||||
self.compute_client.hypervisors.return_value = iter(self.hypervisors)
|
||||
|
||||
self.columns = (
|
||||
"ID",
|
||||
@ -108,7 +106,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.hypervisors.assert_called_with(details=True)
|
||||
self.compute_client.hypervisors.assert_called_with(details=True)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, tuple(data))
|
||||
|
||||
@ -123,9 +121,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# Fake the return value of search()
|
||||
self.compute_sdk_client.hypervisors.return_value = [
|
||||
self.hypervisors[0]
|
||||
]
|
||||
self.compute_client.hypervisors.return_value = [self.hypervisors[0]]
|
||||
|
||||
self.data = (
|
||||
(
|
||||
@ -142,7 +138,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.hypervisors.assert_called_with(
|
||||
self.compute_client.hypervisors.assert_called_with(
|
||||
hypervisor_hostname_pattern=self.hypervisors[0].name, details=True
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
@ -159,9 +155,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
# Fake exception raised from search()
|
||||
self.compute_sdk_client.hypervisors.side_effect = exceptions.NotFound(
|
||||
None
|
||||
)
|
||||
self.compute_client.hypervisors.side_effect = exceptions.NotFound(None)
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.NotFound, self.cmd.take_action, parsed_args
|
||||
@ -205,7 +199,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.hypervisors.assert_called_with(details=True)
|
||||
self.compute_client.hypervisors.assert_called_with(details=True)
|
||||
self.assertEqual(self.columns_long, columns)
|
||||
self.assertEqual(self.data_long, tuple(data))
|
||||
|
||||
@ -223,7 +217,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.hypervisors.assert_called_with(
|
||||
self.compute_client.hypervisors.assert_called_with(
|
||||
limit=1, details=True
|
||||
)
|
||||
|
||||
@ -261,7 +255,7 @@ class TestHypervisorList(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.hypervisors.assert_called_with(
|
||||
self.compute_client.hypervisors.assert_called_with(
|
||||
marker='test_hyp', details=True
|
||||
)
|
||||
|
||||
@ -303,10 +297,10 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
cpu_info={"aaa": "aaa"},
|
||||
)
|
||||
|
||||
self.compute_sdk_client.find_hypervisor.return_value = self.hypervisor
|
||||
self.compute_sdk_client.get_hypervisor.return_value = self.hypervisor
|
||||
self.compute_client.find_hypervisor.return_value = self.hypervisor
|
||||
self.compute_client.get_hypervisor.return_value = self.hypervisor
|
||||
|
||||
self.compute_sdk_client.aggregates.return_value = []
|
||||
self.compute_client.aggregates.return_value = []
|
||||
|
||||
uptime_info = {
|
||||
'status': self.hypervisor.status,
|
||||
@ -315,9 +309,7 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
'hypervisor_hostname': self.hypervisor.name,
|
||||
'uptime': uptime_string,
|
||||
}
|
||||
self.compute_sdk_client.get_hypervisor_uptime.return_value = (
|
||||
uptime_info
|
||||
)
|
||||
self.compute_client.get_hypervisor_uptime.return_value = uptime_info
|
||||
|
||||
self.columns_v288 = (
|
||||
'aggregates',
|
||||
@ -434,10 +426,10 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(self.columns_v288, columns)
|
||||
self.assertCountEqual(self.data_v288, data)
|
||||
|
||||
self.compute_sdk_client.find_hypervisor.assert_called_once_with(
|
||||
self.compute_client.find_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.name, ignore_missing=False, details=False
|
||||
)
|
||||
self.compute_sdk_client.get_hypervisor.assert_called_once_with(
|
||||
self.compute_client.get_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.id
|
||||
)
|
||||
|
||||
@ -460,10 +452,10 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(self.data, data)
|
||||
|
||||
self.compute_sdk_client.find_hypervisor.assert_called_once_with(
|
||||
self.compute_client.find_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.name, ignore_missing=False, details=False
|
||||
)
|
||||
self.compute_sdk_client.get_hypervisor.assert_called_once_with(
|
||||
self.compute_client.get_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.id
|
||||
)
|
||||
|
||||
@ -473,7 +465,7 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
# before microversion 2.28, nova returned a stringified version of this
|
||||
# field
|
||||
self.hypervisor.cpu_info = json.dumps(self.hypervisor.cpu_info)
|
||||
self.compute_sdk_client.find_hypervisor.return_value = self.hypervisor
|
||||
self.compute_client.find_hypervisor.return_value = self.hypervisor
|
||||
|
||||
arglist = [
|
||||
self.hypervisor.name,
|
||||
@ -491,10 +483,10 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(self.data, data)
|
||||
|
||||
self.compute_sdk_client.find_hypervisor.assert_called_once_with(
|
||||
self.compute_client.find_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.name, ignore_missing=False, details=False
|
||||
)
|
||||
self.compute_sdk_client.get_hypervisor.assert_called_once_with(
|
||||
self.compute_client.get_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.id
|
||||
)
|
||||
|
||||
@ -509,7 +501,7 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.get_hypervisor_uptime.side_effect = (
|
||||
self.compute_client.get_hypervisor_uptime.side_effect = (
|
||||
sdk_exceptions.HttpException(http_status=501)
|
||||
)
|
||||
|
||||
@ -570,9 +562,9 @@ class TestHypervisorShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(expected_columns, columns)
|
||||
self.assertCountEqual(expected_data, data)
|
||||
|
||||
self.compute_sdk_client.find_hypervisor.assert_called_once_with(
|
||||
self.compute_client.find_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.name, ignore_missing=False, details=False
|
||||
)
|
||||
self.compute_sdk_client.get_hypervisor.assert_called_once_with(
|
||||
self.compute_client.get_hypervisor.assert_called_once_with(
|
||||
self.hypervisor.id
|
||||
)
|
||||
|
@ -23,7 +23,7 @@ class TestHypervisorStats(compute_fakes.TestComputev2):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.get = mock.Mock()
|
||||
self.compute_client.get = mock.Mock()
|
||||
|
||||
|
||||
# Not in fakes.py because hypervisor stats has been deprecated
|
||||
@ -67,7 +67,7 @@ class TestHypervisorStatsShow(TestHypervisorStats):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.get.return_value = fakes.FakeResponse(
|
||||
self.compute_client.get.return_value = fakes.FakeResponse(
|
||||
data={'hypervisor_statistics': self._stats}
|
||||
)
|
||||
|
||||
|
@ -66,7 +66,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
# Get the command object to test
|
||||
self.cmd = keypair.CreateKeypair(self.app, None)
|
||||
|
||||
self.compute_sdk_client.create_keypair.return_value = self.keypair
|
||||
self.compute_client.create_keypair.return_value = self.keypair
|
||||
|
||||
@mock.patch.object(
|
||||
keypair,
|
||||
@ -84,7 +84,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_keypair.assert_called_with(
|
||||
self.compute_client.create_keypair.assert_called_with(
|
||||
name=self.keypair.name,
|
||||
public_key=mock_generate.return_value.public_key,
|
||||
)
|
||||
@ -124,7 +124,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_keypair.assert_called_with(
|
||||
self.compute_client.create_keypair.assert_called_with(
|
||||
name=self.keypair.name,
|
||||
public_key=self.keypair.public_key,
|
||||
)
|
||||
@ -159,7 +159,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_keypair.assert_called_with(
|
||||
self.compute_client.create_keypair.assert_called_with(
|
||||
name=self.keypair.name,
|
||||
public_key=mock_generate.return_value.public_key,
|
||||
)
|
||||
@ -176,7 +176,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
self.set_compute_api_version('2.2')
|
||||
|
||||
for key_type in ['x509', 'ssh']:
|
||||
self.compute_sdk_client.create_keypair.return_value = self.keypair
|
||||
self.compute_client.create_keypair.return_value = self.keypair
|
||||
|
||||
self.data = (
|
||||
self.keypair.created_at,
|
||||
@ -209,7 +209,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
m_file.read.return_value = self.keypair.public_key
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_keypair.assert_called_with(
|
||||
self.compute_client.create_keypair.assert_called_with(
|
||||
name=self.keypair.name,
|
||||
public_key=self.keypair.public_key,
|
||||
key_type=key_type,
|
||||
@ -272,7 +272,7 @@ class TestKeypairCreate(TestKeypair):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_keypair.assert_called_with(
|
||||
self.compute_client.create_keypair.assert_called_with(
|
||||
name=self.keypair.name,
|
||||
user_id=self._user.id,
|
||||
public_key=mock_generate.return_value.public_key,
|
||||
@ -324,7 +324,7 @@ class TestKeypairDelete(TestKeypair):
|
||||
ret = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertIsNone(ret)
|
||||
self.compute_sdk_client.delete_keypair.assert_called_with(
|
||||
self.compute_client.delete_keypair.assert_called_with(
|
||||
self.keypairs[0].name, ignore_missing=False
|
||||
)
|
||||
|
||||
@ -342,7 +342,7 @@ class TestKeypairDelete(TestKeypair):
|
||||
calls = []
|
||||
for k in self.keypairs:
|
||||
calls.append(call(k.name, ignore_missing=False))
|
||||
self.compute_sdk_client.delete_keypair.assert_has_calls(calls)
|
||||
self.compute_client.delete_keypair.assert_has_calls(calls)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_delete_multiple_keypairs_with_exception(self):
|
||||
@ -356,7 +356,7 @@ class TestKeypairDelete(TestKeypair):
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.delete_keypair.side_effect = [
|
||||
self.compute_client.delete_keypair.side_effect = [
|
||||
None,
|
||||
exceptions.CommandError,
|
||||
]
|
||||
@ -369,7 +369,7 @@ class TestKeypairDelete(TestKeypair):
|
||||
calls = []
|
||||
for k in arglist:
|
||||
calls.append(call(k, ignore_missing=False))
|
||||
self.compute_sdk_client.delete_keypair.assert_has_calls(calls)
|
||||
self.compute_client.delete_keypair.assert_has_calls(calls)
|
||||
|
||||
def test_keypair_delete_with_user(self):
|
||||
self.set_compute_api_version('2.10')
|
||||
@ -384,7 +384,7 @@ class TestKeypairDelete(TestKeypair):
|
||||
ret = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.assertIsNone(ret)
|
||||
self.compute_sdk_client.delete_keypair.assert_called_with(
|
||||
self.compute_client.delete_keypair.assert_called_with(
|
||||
self.keypairs[0].name,
|
||||
user_id=self._user.id,
|
||||
ignore_missing=False,
|
||||
@ -415,7 +415,7 @@ class TestKeypairList(TestKeypair):
|
||||
self.keypairs = list(
|
||||
sdk_fakes.generate_fake_resources(_keypair.Keypair, count=1)
|
||||
)
|
||||
self.compute_sdk_client.keypairs.return_value = iter(self.keypairs)
|
||||
self.compute_client.keypairs.return_value = iter(self.keypairs)
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = keypair.ListKeypair(self.app, None)
|
||||
@ -435,7 +435,7 @@ class TestKeypairList(TestKeypair):
|
||||
|
||||
# Set expected values
|
||||
|
||||
self.compute_sdk_client.keypairs.assert_called_with()
|
||||
self.compute_client.keypairs.assert_called_with()
|
||||
|
||||
self.assertEqual(('Name', 'Fingerprint'), columns)
|
||||
self.assertEqual(
|
||||
@ -458,7 +458,7 @@ class TestKeypairList(TestKeypair):
|
||||
|
||||
# Set expected values
|
||||
|
||||
self.compute_sdk_client.keypairs.assert_called_with()
|
||||
self.compute_client.keypairs.assert_called_with()
|
||||
|
||||
self.assertEqual(('Name', 'Fingerprint', 'Type'), columns)
|
||||
self.assertEqual(
|
||||
@ -491,7 +491,7 @@ class TestKeypairList(TestKeypair):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
users_mock.get.assert_called_with(self._user.name)
|
||||
self.compute_sdk_client.keypairs.assert_called_with(
|
||||
self.compute_client.keypairs.assert_called_with(
|
||||
user_id=self._user.id,
|
||||
)
|
||||
|
||||
@ -545,7 +545,7 @@ class TestKeypairList(TestKeypair):
|
||||
|
||||
projects_mock.get.assert_called_with(self._project.name)
|
||||
users_mock.list.assert_called_with(tenant_id=self._project.id)
|
||||
self.compute_sdk_client.keypairs.assert_called_with(
|
||||
self.compute_client.keypairs.assert_called_with(
|
||||
user_id=self._user.id,
|
||||
)
|
||||
|
||||
@ -605,7 +605,7 @@ class TestKeypairList(TestKeypair):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.keypairs.assert_called_with(limit=1)
|
||||
self.compute_client.keypairs.assert_called_with(limit=1)
|
||||
|
||||
def test_keypair_list_with_limit_pre_v235(self):
|
||||
self.set_compute_api_version('2.34')
|
||||
@ -641,7 +641,7 @@ class TestKeypairList(TestKeypair):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.keypairs.assert_called_with(marker='test_kp')
|
||||
self.compute_client.keypairs.assert_called_with(marker='test_kp')
|
||||
|
||||
def test_keypair_list_with_marker_pre_v235(self):
|
||||
self.set_compute_api_version('2.34')
|
||||
@ -696,7 +696,7 @@ class TestKeypairShow(TestKeypair):
|
||||
|
||||
def test_keypair_show(self):
|
||||
self.keypair = sdk_fakes.generate_fake_resource(_keypair.Keypair)
|
||||
self.compute_sdk_client.find_keypair.return_value = self.keypair
|
||||
self.compute_client.find_keypair.return_value = self.keypair
|
||||
|
||||
self.data = (
|
||||
self.keypair.created_at,
|
||||
@ -715,7 +715,7 @@ class TestKeypairShow(TestKeypair):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_keypair.assert_called_with(
|
||||
self.compute_client.find_keypair.assert_called_with(
|
||||
self.keypair.name, ignore_missing=False
|
||||
)
|
||||
|
||||
@ -724,7 +724,7 @@ class TestKeypairShow(TestKeypair):
|
||||
|
||||
def test_keypair_show_public(self):
|
||||
self.keypair = sdk_fakes.generate_fake_resource(_keypair.Keypair)
|
||||
self.compute_sdk_client.find_keypair.return_value = self.keypair
|
||||
self.compute_client.find_keypair.return_value = self.keypair
|
||||
|
||||
arglist = ['--public-key', self.keypair.name]
|
||||
verifylist = [('public_key', True), ('name', self.keypair.name)]
|
||||
@ -740,7 +740,7 @@ class TestKeypairShow(TestKeypair):
|
||||
self.set_compute_api_version('2.10')
|
||||
|
||||
self.keypair = sdk_fakes.generate_fake_resource(_keypair.Keypair)
|
||||
self.compute_sdk_client.find_keypair.return_value = self.keypair
|
||||
self.compute_client.find_keypair.return_value = self.keypair
|
||||
|
||||
self.data = (
|
||||
self.keypair.created_at,
|
||||
@ -767,7 +767,7 @@ class TestKeypairShow(TestKeypair):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.users_mock.get.assert_called_with(self._user.name)
|
||||
self.compute_sdk_client.find_keypair.assert_called_with(
|
||||
self.compute_client.find_keypair.assert_called_with(
|
||||
self.keypair.name,
|
||||
ignore_missing=False,
|
||||
user_id=self._user.id,
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -27,9 +27,7 @@ class TestServerBackup(compute_fakes.TestComputev2):
|
||||
servers = compute_fakes.create_sdk_servers(
|
||||
count=count,
|
||||
)
|
||||
|
||||
# This is the return value for compute_client.find_server()
|
||||
self.compute_sdk_client.find_server = compute_fakes.get_servers(
|
||||
self.compute_client.find_server = compute_fakes.get_servers(
|
||||
servers,
|
||||
0,
|
||||
)
|
||||
@ -110,7 +108,7 @@ class TestServerBackupCreate(TestServerBackup):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.backup_server.assert_called_with(
|
||||
self.compute_client.backup_server.assert_called_with(
|
||||
servers[0].id,
|
||||
servers[0].name,
|
||||
'',
|
||||
@ -146,7 +144,7 @@ class TestServerBackupCreate(TestServerBackup):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.backup_server.assert_called_with(
|
||||
self.compute_client.backup_server.assert_called_with(
|
||||
servers[0].id,
|
||||
'image',
|
||||
'daily',
|
||||
@ -186,7 +184,7 @@ class TestServerBackupCreate(TestServerBackup):
|
||||
parsed_args,
|
||||
)
|
||||
|
||||
self.compute_sdk_client.backup_server.assert_called_with(
|
||||
self.compute_client.backup_server.assert_called_with(
|
||||
servers[0].id,
|
||||
'image',
|
||||
'daily',
|
||||
@ -227,7 +225,7 @@ class TestServerBackupCreate(TestServerBackup):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.backup_server.assert_called_with(
|
||||
self.compute_client.backup_server.assert_called_with(
|
||||
servers[0].id,
|
||||
'image',
|
||||
'daily',
|
||||
|
@ -64,8 +64,8 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_server.return_value = self.fake_server
|
||||
self.compute_sdk_client.server_actions.return_value = [
|
||||
self.compute_client.find_server.return_value = self.fake_server
|
||||
self.compute_client.server_actions.return_value = [
|
||||
self.fake_event,
|
||||
]
|
||||
|
||||
@ -83,11 +83,11 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.fake_server.name,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id
|
||||
)
|
||||
|
||||
@ -107,11 +107,11 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.fake_server.name,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id
|
||||
)
|
||||
|
||||
@ -134,11 +134,11 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.fake_server.name,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id,
|
||||
changes_since='2016-03-04T06:27:59Z',
|
||||
)
|
||||
@ -214,11 +214,11 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.fake_server.name,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id,
|
||||
changes_before='2016-03-04T06:27:59Z',
|
||||
)
|
||||
@ -290,7 +290,7 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id,
|
||||
limit=1,
|
||||
paginated=False,
|
||||
@ -337,7 +337,7 @@ class TestListServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.server_actions.assert_called_with(
|
||||
self.compute_client.server_actions.assert_called_with(
|
||||
self.fake_server.id,
|
||||
marker='test_event',
|
||||
)
|
||||
@ -392,10 +392,8 @@ class TestShowServerEvent(compute_fakes.TestComputev2):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_server.return_value = self.fake_server
|
||||
self.compute_sdk_client.get_server_action.return_value = (
|
||||
self.fake_event
|
||||
)
|
||||
self.compute_client.find_server.return_value = self.fake_server
|
||||
self.compute_client.get_server_action.return_value = self.fake_event
|
||||
|
||||
self.cmd = server_event.ShowServerEvent(self.app, None)
|
||||
|
||||
@ -412,11 +410,11 @@ class TestShowServerEvent(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.fake_server.name,
|
||||
ignore_missing=False,
|
||||
)
|
||||
self.compute_sdk_client.get_server_action.assert_called_with(
|
||||
self.compute_client.get_server_action.assert_called_with(
|
||||
self.fake_event.request_id,
|
||||
self.fake_server.id,
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ class TestServerGroupCreate(TestServerGroup):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.create_server_group.return_value = (
|
||||
self.compute_client.create_server_group.return_value = (
|
||||
self.fake_server_group
|
||||
)
|
||||
self.cmd = server_group.CreateServerGroup(self.app, None)
|
||||
@ -74,7 +74,7 @@ class TestServerGroupCreate(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_server_group.assert_called_once_with(
|
||||
self.compute_client.create_server_group.assert_called_once_with(
|
||||
name=parsed_args.name,
|
||||
policy=parsed_args.policy,
|
||||
)
|
||||
@ -96,7 +96,7 @@ class TestServerGroupCreate(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_server_group.assert_called_once_with(
|
||||
self.compute_client.create_server_group.assert_called_once_with(
|
||||
name=parsed_args.name,
|
||||
policy=parsed_args.policy,
|
||||
)
|
||||
@ -141,7 +141,7 @@ class TestServerGroupCreate(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.create_server_group.assert_called_once_with(
|
||||
self.compute_client.create_server_group.assert_called_once_with(
|
||||
name=parsed_args.name,
|
||||
policy=parsed_args.policy,
|
||||
rules=parsed_args.rules,
|
||||
@ -179,7 +179,7 @@ class TestServerGroupDelete(TestServerGroup):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_server_group.return_value = (
|
||||
self.compute_client.find_server_group.return_value = (
|
||||
self.fake_server_group
|
||||
)
|
||||
self.cmd = server_group.DeleteServerGroup(self.app, None)
|
||||
@ -193,10 +193,10 @@ class TestServerGroupDelete(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_server_group.assert_called_once_with(
|
||||
self.compute_client.find_server_group.assert_called_once_with(
|
||||
'affinity_group', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_server_group.assert_called_once_with(
|
||||
self.compute_client.delete_server_group.assert_called_once_with(
|
||||
self.fake_server_group.id
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -208,21 +208,17 @@ class TestServerGroupDelete(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.find_server_group.assert_any_call(
|
||||
self.compute_client.find_server_group.assert_any_call(
|
||||
'affinity_group', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.find_server_group.assert_any_call(
|
||||
self.compute_client.find_server_group.assert_any_call(
|
||||
'anti_affinity_group', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_server_group.assert_called_with(
|
||||
self.compute_client.delete_server_group.assert_called_with(
|
||||
self.fake_server_group.id
|
||||
)
|
||||
self.assertEqual(
|
||||
2, self.compute_sdk_client.find_server_group.call_count
|
||||
)
|
||||
self.assertEqual(
|
||||
2, self.compute_sdk_client.delete_server_group.call_count
|
||||
)
|
||||
self.assertEqual(2, self.compute_client.find_server_group.call_count)
|
||||
self.assertEqual(2, self.compute_client.delete_server_group.call_count)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_server_group_delete_no_input(self):
|
||||
@ -243,7 +239,7 @@ class TestServerGroupDelete(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
self.compute_sdk_client.find_server_group.side_effect = [
|
||||
self.compute_client.find_server_group.side_effect = [
|
||||
self.fake_server_group,
|
||||
exceptions.CommandError,
|
||||
]
|
||||
@ -253,16 +249,14 @@ class TestServerGroupDelete(TestServerGroup):
|
||||
except exceptions.CommandError as e:
|
||||
self.assertEqual('1 of 2 server groups failed to delete.', str(e))
|
||||
|
||||
self.compute_sdk_client.find_server_group.assert_any_call(
|
||||
self.compute_client.find_server_group.assert_any_call(
|
||||
'affinity_group', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.find_server_group.assert_any_call(
|
||||
self.compute_client.find_server_group.assert_any_call(
|
||||
'anti_affinity_group', ignore_missing=False
|
||||
)
|
||||
self.assertEqual(
|
||||
2, self.compute_sdk_client.find_server_group.call_count
|
||||
)
|
||||
self.compute_sdk_client.delete_server_group.assert_called_once_with(
|
||||
self.assertEqual(2, self.compute_client.find_server_group.call_count)
|
||||
self.compute_client.delete_server_group.assert_called_once_with(
|
||||
self.fake_server_group.id
|
||||
)
|
||||
|
||||
@ -271,7 +265,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.server_groups.return_value = [
|
||||
self.compute_client.server_groups.return_value = [
|
||||
self.fake_server_group
|
||||
]
|
||||
self.cmd = server_group.ListServerGroup(self.app, None)
|
||||
@ -287,7 +281,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with()
|
||||
self.compute_client.server_groups.assert_called_once_with()
|
||||
|
||||
expected_columns = (
|
||||
'ID',
|
||||
@ -318,7 +312,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with(
|
||||
self.compute_client.server_groups.assert_called_once_with(
|
||||
all_projects=True
|
||||
)
|
||||
|
||||
@ -359,7 +353,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with(limit=1)
|
||||
self.compute_client.server_groups.assert_called_once_with(limit=1)
|
||||
|
||||
def test_server_group_list_with_offset(self):
|
||||
arglist = [
|
||||
@ -376,7 +370,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with(offset=5)
|
||||
self.compute_client.server_groups.assert_called_once_with(offset=5)
|
||||
|
||||
def test_server_group_list_v264(self):
|
||||
self.set_compute_api_version('2.64')
|
||||
@ -388,7 +382,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with()
|
||||
self.compute_client.server_groups.assert_called_once_with()
|
||||
|
||||
expected_columns = (
|
||||
'ID',
|
||||
@ -419,7 +413,7 @@ class TestServerGroupList(TestServerGroup):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.server_groups.assert_called_once_with(
|
||||
self.compute_client.server_groups.assert_called_once_with(
|
||||
all_projects=True
|
||||
)
|
||||
|
||||
@ -450,7 +444,7 @@ class TestServerGroupShow(TestServerGroup):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.find_server_group.return_value = (
|
||||
self.compute_client.find_server_group.return_value = (
|
||||
self.fake_server_group
|
||||
)
|
||||
self.cmd = server_group.ShowServerGroup(self.app, None)
|
||||
|
@ -26,9 +26,7 @@ class TestServerImage(compute_fakes.TestComputev2):
|
||||
servers = compute_fakes.create_sdk_servers(
|
||||
count=count,
|
||||
)
|
||||
|
||||
# This is the return value for compute_client.find_server()
|
||||
self.compute_sdk_client.find_server = compute_fakes.get_servers(
|
||||
self.compute_client.find_server = compute_fakes.get_servers(
|
||||
servers,
|
||||
0,
|
||||
)
|
||||
@ -85,7 +83,7 @@ class TestServerImageCreate(TestServerImage):
|
||||
)
|
||||
|
||||
self.image_client.find_image = mock.Mock(side_effect=images)
|
||||
self.compute_sdk_client.create_server_image = mock.Mock(
|
||||
self.compute_client.create_server_image = mock.Mock(
|
||||
return_value=images[0],
|
||||
)
|
||||
return images
|
||||
@ -107,7 +105,7 @@ class TestServerImageCreate(TestServerImage):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_server_image.assert_called_with(
|
||||
self.compute_client.create_server_image.assert_called_with(
|
||||
servers[0].id,
|
||||
servers[0].name,
|
||||
None,
|
||||
@ -139,7 +137,7 @@ class TestServerImageCreate(TestServerImage):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_server_image.assert_called_with(
|
||||
self.compute_client.create_server_image.assert_called_with(
|
||||
servers[0].id,
|
||||
'img-nam',
|
||||
{'key': 'value'},
|
||||
@ -169,7 +167,7 @@ class TestServerImageCreate(TestServerImage):
|
||||
parsed_args,
|
||||
)
|
||||
|
||||
self.compute_sdk_client.create_server_image.assert_called_with(
|
||||
self.compute_client.create_server_image.assert_called_with(
|
||||
servers[0].id,
|
||||
servers[0].name,
|
||||
None,
|
||||
@ -199,7 +197,7 @@ class TestServerImageCreate(TestServerImage):
|
||||
# data to be shown.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.create_server_image.assert_called_with(
|
||||
self.compute_client.create_server_image.assert_called_with(
|
||||
servers[0].id,
|
||||
servers[0].name,
|
||||
None,
|
||||
|
@ -53,10 +53,10 @@ class TestListMigration(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self.server = compute_fakes.create_one_sdk_server()
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
self.migrations = compute_fakes.create_migrations(count=3)
|
||||
self.compute_sdk_client.migrations.return_value = self.migrations
|
||||
self.compute_client.migrations.return_value = self.migrations
|
||||
|
||||
self.data = (
|
||||
common_utils.get_item_properties(s, self.MIGRATION_FIELDS)
|
||||
@ -76,7 +76,7 @@ class TestListMigration(compute_fakes.TestComputev2):
|
||||
# Set expected values
|
||||
kwargs = {}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.assertEqual(self.MIGRATION_COLUMNS, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
@ -108,10 +108,10 @@ class TestListMigration(compute_fakes.TestComputev2):
|
||||
'migration_type': 'migration',
|
||||
}
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
'server1', ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.assertEqual(self.MIGRATION_COLUMNS, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
@ -169,7 +169,7 @@ class TestListMigrationV223(TestListMigration):
|
||||
'status': 'migrating',
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.assertEqual(self.MIGRATION_COLUMNS, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
@ -247,7 +247,7 @@ class TestListMigrationV259(TestListMigration):
|
||||
'changes_since': '2019-08-09T08:03:25Z',
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.assertEqual(self.MIGRATION_COLUMNS, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
@ -376,7 +376,7 @@ class TestListMigrationV266(TestListMigration):
|
||||
'changes_before': '2019-08-09T08:03:25Z',
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.assertEqual(self.MIGRATION_COLUMNS, columns)
|
||||
self.assertEqual(tuple(self.data), tuple(data))
|
||||
@ -495,7 +495,7 @@ class TestListMigrationV280(TestListMigration):
|
||||
'changes_before': "2019-08-09T08:03:25Z",
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.MIGRATION_COLUMNS.insert(
|
||||
len(self.MIGRATION_COLUMNS) - 2, "Project"
|
||||
@ -572,7 +572,7 @@ class TestListMigrationV280(TestListMigration):
|
||||
'changes_before': "2019-08-09T08:03:25Z",
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.MIGRATION_COLUMNS.insert(len(self.MIGRATION_COLUMNS) - 2, "User")
|
||||
self.MIGRATION_FIELDS.insert(len(self.MIGRATION_FIELDS) - 2, "user_id")
|
||||
@ -644,7 +644,7 @@ class TestListMigrationV280(TestListMigration):
|
||||
'changes_before': "2019-08-09T08:03:25Z",
|
||||
}
|
||||
|
||||
self.compute_sdk_client.migrations.assert_called_with(**kwargs)
|
||||
self.compute_client.migrations.assert_called_with(**kwargs)
|
||||
|
||||
self.MIGRATION_COLUMNS.insert(
|
||||
len(self.MIGRATION_COLUMNS) - 2, "Project"
|
||||
@ -695,13 +695,13 @@ class TestServerMigrationShow(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self.server = compute_fakes.create_one_sdk_server()
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
self.server_migration = compute_fakes.create_one_server_migration()
|
||||
self.compute_sdk_client.get_server_migration.return_value = (
|
||||
self.compute_client.get_server_migration.return_value = (
|
||||
self.server_migration
|
||||
)
|
||||
self.compute_sdk_client.server_migrations.return_value = iter(
|
||||
self.compute_client.server_migrations.return_value = iter(
|
||||
[self.server_migration]
|
||||
)
|
||||
|
||||
@ -759,10 +759,10 @@ class TestServerMigrationShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.get_server_migration.assert_called_with(
|
||||
self.compute_client.get_server_migration.assert_called_with(
|
||||
self.server.id, '2', ignore_missing=False
|
||||
)
|
||||
|
||||
@ -811,7 +811,7 @@ class TestServerMigrationShow(compute_fakes.TestComputev2):
|
||||
def test_server_migration_show_by_uuid(self):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.compute_sdk_client.server_migrations.return_value = iter(
|
||||
self.compute_client.server_migrations.return_value = iter(
|
||||
[self.server_migration]
|
||||
)
|
||||
|
||||
@ -830,18 +830,18 @@ class TestServerMigrationShow(compute_fakes.TestComputev2):
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.server_migrations.assert_called_with(
|
||||
self.compute_client.server_migrations.assert_called_with(
|
||||
self.server.id
|
||||
)
|
||||
self.compute_sdk_client.get_server_migration.assert_not_called()
|
||||
self.compute_client.get_server_migration.assert_not_called()
|
||||
|
||||
def test_server_migration_show_by_uuid_no_matches(self):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.compute_sdk_client.server_migrations.return_value = iter([])
|
||||
self.compute_client.server_migrations.return_value = iter([])
|
||||
|
||||
arglist = [
|
||||
self.server.id,
|
||||
@ -900,7 +900,7 @@ class TestServerMigrationAbort(compute_fakes.TestComputev2):
|
||||
self.server = compute_fakes.create_one_sdk_server()
|
||||
|
||||
# Return value for utils.find_resource for server.
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server_migration.AbortMigration(self.app, None)
|
||||
@ -917,10 +917,10 @@ class TestServerMigrationAbort(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.abort_server_migration.assert_called_with(
|
||||
self.compute_client.abort_server_migration.assert_called_with(
|
||||
'2', self.server.id, ignore_missing=False
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -946,7 +946,7 @@ class TestServerMigrationAbort(compute_fakes.TestComputev2):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.server_migration = compute_fakes.create_one_server_migration()
|
||||
self.compute_sdk_client.server_migrations.return_value = iter(
|
||||
self.compute_client.server_migrations.return_value = iter(
|
||||
[self.server_migration]
|
||||
)
|
||||
|
||||
@ -959,13 +959,13 @@ class TestServerMigrationAbort(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.server_migrations.assert_called_with(
|
||||
self.compute_client.server_migrations.assert_called_with(
|
||||
self.server.id
|
||||
)
|
||||
self.compute_sdk_client.abort_server_migration.assert_called_with(
|
||||
self.compute_client.abort_server_migration.assert_called_with(
|
||||
self.server_migration.id, self.server.id, ignore_missing=False
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -973,7 +973,7 @@ class TestServerMigrationAbort(compute_fakes.TestComputev2):
|
||||
def test_server_migration_abort_by_uuid_no_matches(self):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.compute_sdk_client.server_migrations.return_value = iter([])
|
||||
self.compute_client.server_migrations.return_value = iter([])
|
||||
|
||||
arglist = [
|
||||
self.server.id,
|
||||
@ -1015,7 +1015,7 @@ class TestServerMigrationForceComplete(compute_fakes.TestComputev2):
|
||||
self.server = compute_fakes.create_one_sdk_server()
|
||||
|
||||
# Return value for utils.find_resource for server.
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = server_migration.ForceCompleteMigration(self.app, None)
|
||||
@ -1032,10 +1032,10 @@ class TestServerMigrationForceComplete(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.force_complete_server_migration.assert_called_with(
|
||||
self.compute_client.force_complete_server_migration.assert_called_with(
|
||||
'2', self.server.id
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -1061,7 +1061,7 @@ class TestServerMigrationForceComplete(compute_fakes.TestComputev2):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.server_migration = compute_fakes.create_one_server_migration()
|
||||
self.compute_sdk_client.server_migrations.return_value = iter(
|
||||
self.compute_client.server_migrations.return_value = iter(
|
||||
[self.server_migration]
|
||||
)
|
||||
|
||||
@ -1074,13 +1074,13 @@ class TestServerMigrationForceComplete(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.find_server.assert_called_with(
|
||||
self.compute_client.find_server.assert_called_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.server_migrations.assert_called_with(
|
||||
self.compute_client.server_migrations.assert_called_with(
|
||||
self.server.id
|
||||
)
|
||||
self.compute_sdk_client.force_complete_server_migration.assert_called_with(
|
||||
self.compute_client.force_complete_server_migration.assert_called_with(
|
||||
self.server_migration.id, self.server.id
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -1088,7 +1088,7 @@ class TestServerMigrationForceComplete(compute_fakes.TestComputev2):
|
||||
def test_server_migration_force_complete_by_uuid_no_matches(self):
|
||||
self.set_compute_api_version('2.59')
|
||||
|
||||
self.compute_sdk_client.server_migrations.return_value = iter([])
|
||||
self.compute_client.server_migrations.return_value = iter([])
|
||||
|
||||
arglist = [
|
||||
self.server.id,
|
||||
|
@ -31,8 +31,8 @@ class TestServerVolumeList(compute_fakes.TestComputev2):
|
||||
)
|
||||
)
|
||||
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_sdk_client.volume_attachments.return_value = (
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
self.compute_client.volume_attachments.return_value = (
|
||||
self.volume_attachments
|
||||
)
|
||||
|
||||
@ -68,7 +68,7 @@ class TestServerVolumeList(compute_fakes.TestComputev2):
|
||||
),
|
||||
tuple(data),
|
||||
)
|
||||
self.compute_sdk_client.volume_attachments.assert_called_once_with(
|
||||
self.compute_client.volume_attachments.assert_called_once_with(
|
||||
self.server,
|
||||
)
|
||||
|
||||
@ -114,7 +114,7 @@ class TestServerVolumeList(compute_fakes.TestComputev2):
|
||||
),
|
||||
tuple(data),
|
||||
)
|
||||
self.compute_sdk_client.volume_attachments.assert_called_once_with(
|
||||
self.compute_client.volume_attachments.assert_called_once_with(
|
||||
self.server,
|
||||
)
|
||||
|
||||
@ -163,7 +163,7 @@ class TestServerVolumeList(compute_fakes.TestComputev2):
|
||||
),
|
||||
tuple(data),
|
||||
)
|
||||
self.compute_sdk_client.volume_attachments.assert_called_once_with(
|
||||
self.compute_client.volume_attachments.assert_called_once_with(
|
||||
self.server,
|
||||
)
|
||||
|
||||
@ -215,7 +215,7 @@ class TestServerVolumeList(compute_fakes.TestComputev2):
|
||||
),
|
||||
tuple(data),
|
||||
)
|
||||
self.compute_sdk_client.volume_attachments.assert_called_once_with(
|
||||
self.compute_client.volume_attachments.assert_called_once_with(
|
||||
self.server,
|
||||
)
|
||||
|
||||
@ -225,7 +225,7 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
super().setUp()
|
||||
|
||||
self.server = sdk_fakes.generate_fake_resource(_server.Server)
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
self.volume = sdk_fakes.generate_fake_resource(_volume.Volume)
|
||||
self.volume_sdk_client.find_volume.return_value = self.volume
|
||||
@ -248,7 +248,7 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
# This is a no-op
|
||||
self.compute_sdk_client.update_volume_attachment.assert_not_called()
|
||||
self.compute_client.update_volume_attachment.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_server_volume_update_with_delete_on_termination(self):
|
||||
@ -268,7 +268,7 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.update_volume_attachment.assert_called_once_with(
|
||||
self.compute_client.update_volume_attachment.assert_called_once_with(
|
||||
self.server,
|
||||
self.volume,
|
||||
delete_on_termination=True,
|
||||
@ -292,7 +292,7 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.update_volume_attachment.assert_called_once_with(
|
||||
self.compute_client.update_volume_attachment.assert_called_once_with(
|
||||
self.server, self.volume, delete_on_termination=False
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -317,7 +317,7 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
self.cmd.take_action,
|
||||
parsed_args,
|
||||
)
|
||||
self.compute_sdk_client.update_volume_attachment.assert_not_called()
|
||||
self.compute_client.update_volume_attachment.assert_not_called()
|
||||
|
||||
def test_server_volume_update_with_preserve_on_termination_pre_v285(self):
|
||||
self.set_compute_api_version('2.84')
|
||||
@ -339,4 +339,4 @@ class TestServerVolumeUpdate(compute_fakes.TestComputev2):
|
||||
self.cmd.take_action,
|
||||
parsed_args,
|
||||
)
|
||||
self.compute_sdk_client.update_volume_attachment.assert_not_called()
|
||||
self.compute_client.update_volume_attachment.assert_not_called()
|
||||
|
@ -30,7 +30,7 @@ class TestServiceDelete(compute_fakes.TestComputev2):
|
||||
sdk_fakes.generate_fake_resources(_service.Service, count=2)
|
||||
)
|
||||
|
||||
self.compute_sdk_client.delete_service.return_value = None
|
||||
self.compute_client.delete_service.return_value = None
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = service.DeleteService(self.app, None)
|
||||
@ -46,7 +46,7 @@ class TestServiceDelete(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.delete_service.assert_called_with(
|
||||
self.compute_client.delete_service.assert_called_with(
|
||||
self.services[0].binary, ignore_missing=False
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -65,7 +65,7 @@ class TestServiceDelete(compute_fakes.TestComputev2):
|
||||
calls = []
|
||||
for s in self.services:
|
||||
calls.append(mock.call(s.binary, ignore_missing=False))
|
||||
self.compute_sdk_client.delete_service.assert_has_calls(calls)
|
||||
self.compute_client.delete_service.assert_has_calls(calls)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_multi_services_delete_with_exception(self):
|
||||
@ -77,7 +77,7 @@ class TestServiceDelete(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
delete_mock_result = [None, exceptions.CommandError]
|
||||
self.compute_sdk_client.delete_service = mock.Mock(
|
||||
self.compute_client.delete_service = mock.Mock(
|
||||
side_effect=delete_mock_result
|
||||
)
|
||||
|
||||
@ -89,10 +89,10 @@ class TestServiceDelete(compute_fakes.TestComputev2):
|
||||
'1 of 2 compute services failed to delete.', str(e)
|
||||
)
|
||||
|
||||
self.compute_sdk_client.delete_service.assert_any_call(
|
||||
self.compute_client.delete_service.assert_any_call(
|
||||
self.services[0].binary, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.delete_service.assert_any_call(
|
||||
self.compute_client.delete_service.assert_any_call(
|
||||
'unexist_service', ignore_missing=False
|
||||
)
|
||||
|
||||
@ -103,7 +103,7 @@ class TestServiceList(compute_fakes.TestComputev2):
|
||||
|
||||
self.service = sdk_fakes.generate_fake_resource(_service.Service)
|
||||
|
||||
self.compute_sdk_client.services.return_value = [self.service]
|
||||
self.compute_client.services.return_value = [self.service]
|
||||
|
||||
# Get the command object to test
|
||||
self.cmd = service.ListService(self.app, None)
|
||||
@ -126,7 +126,7 @@ class TestServiceList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.services.assert_called_with(
|
||||
self.compute_client.services.assert_called_with(
|
||||
host=self.service.host,
|
||||
binary=self.service.binary,
|
||||
)
|
||||
@ -175,7 +175,7 @@ class TestServiceList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.services.assert_called_with(
|
||||
self.compute_client.services.assert_called_with(
|
||||
host=self.service.host,
|
||||
binary=self.service.binary,
|
||||
)
|
||||
@ -228,7 +228,7 @@ class TestServiceList(compute_fakes.TestComputev2):
|
||||
# containing the data to be listed.
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.services.assert_called_with(
|
||||
self.compute_client.services.assert_called_with(
|
||||
host=self.service.host,
|
||||
binary=self.service.binary,
|
||||
)
|
||||
@ -269,8 +269,8 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
|
||||
self.service = sdk_fakes.generate_fake_resource(_service.Service)
|
||||
|
||||
self.compute_sdk_client.enable_service.return_value = self.service
|
||||
self.compute_sdk_client.disable_service.return_value = self.service
|
||||
self.compute_client.enable_service.return_value = self.service
|
||||
self.compute_client.disable_service.return_value = self.service
|
||||
|
||||
self.cmd = service.SetService(self.app, None)
|
||||
|
||||
@ -286,8 +286,8 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.enable_service.assert_not_called()
|
||||
self.compute_sdk_client.disable_service.assert_not_called()
|
||||
self.compute_client.enable_service.assert_not_called()
|
||||
self.compute_client.disable_service.assert_not_called()
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_service_set_enable(self):
|
||||
@ -305,7 +305,7 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.enable_service.assert_called_with(
|
||||
self.compute_client.enable_service.assert_called_with(
|
||||
None, self.service.host, self.service.binary
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -325,7 +325,7 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.disable_service.assert_called_with(
|
||||
self.compute_client.disable_service.assert_called_with(
|
||||
None, self.service.host, self.service.binary, None
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -349,7 +349,7 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.disable_service.assert_called_with(
|
||||
self.compute_client.disable_service.assert_called_with(
|
||||
None, self.service.host, self.service.binary, reason
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -419,11 +419,11 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
None, self.service.host, self.service.binary, False
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.enable_service)
|
||||
self.assertNotCalled(self.compute_sdk_client.disable_service)
|
||||
self.assertNotCalled(self.compute_client.enable_service)
|
||||
self.assertNotCalled(self.compute_client.disable_service)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_service_set_state_down(self):
|
||||
@ -441,11 +441,11 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
None, self.service.host, self.service.binary, True
|
||||
)
|
||||
self.assertNotCalled(self.compute_sdk_client.enable_service)
|
||||
self.assertNotCalled(self.compute_sdk_client.disable_service)
|
||||
self.assertNotCalled(self.compute_client.enable_service)
|
||||
self.assertNotCalled(self.compute_client.disable_service)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_service_set_enable_and_state_down(self):
|
||||
@ -465,10 +465,10 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.enable_service.assert_called_once_with(
|
||||
self.compute_client.enable_service.assert_called_once_with(
|
||||
None, self.service.host, self.service.binary
|
||||
)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
None, self.service.host, self.service.binary, True
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -491,12 +491,12 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
|
||||
with mock.patch.object(
|
||||
self.compute_sdk_client, 'enable_service', side_effect=Exception()
|
||||
self.compute_client, 'enable_service', side_effect=Exception()
|
||||
):
|
||||
self.assertRaises(
|
||||
exceptions.CommandError, self.cmd.take_action, parsed_args
|
||||
)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
None, self.service.host, self.service.binary, True
|
||||
)
|
||||
|
||||
@ -519,14 +519,12 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
service_id = '339478d0-0b95-4a94-be63-d5be05dfeb1c'
|
||||
self.compute_sdk_client.services.return_value = [
|
||||
mock.Mock(id=service_id)
|
||||
]
|
||||
self.compute_client.services.return_value = [mock.Mock(id=service_id)]
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.disable_service.assert_called_once_with(
|
||||
self.compute_client.disable_service.assert_called_once_with(
|
||||
service_id, self.service.host, self.service.binary, None
|
||||
)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
service_id, self.service.host, self.service.binary, True
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -552,11 +550,9 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
service_id = '339478d0-0b95-4a94-be63-d5be05dfeb1c'
|
||||
self.compute_sdk_client.services.return_value = [
|
||||
mock.Mock(id=service_id)
|
||||
]
|
||||
self.compute_client.services.return_value = [mock.Mock(id=service_id)]
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.disable_service.assert_called_once_with(
|
||||
self.compute_client.disable_service.assert_called_once_with(
|
||||
service_id, self.service.host, self.service.binary, reason
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -580,25 +576,23 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
]
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
service_id = '339478d0-0b95-4a94-be63-d5be05dfeb1c'
|
||||
self.compute_sdk_client.services.return_value = [
|
||||
mock.Mock(id=service_id)
|
||||
]
|
||||
self.compute_client.services.return_value = [mock.Mock(id=service_id)]
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
self.compute_sdk_client.enable_service.assert_called_once_with(
|
||||
self.compute_client.enable_service.assert_called_once_with(
|
||||
service_id, self.service.host, self.service.binary
|
||||
)
|
||||
self.compute_sdk_client.update_service_forced_down.assert_called_once_with(
|
||||
self.compute_client.update_service_forced_down.assert_called_once_with(
|
||||
service_id, self.service.host, self.service.binary, False
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
|
||||
def test_service_set_find_service_by_host_and_binary_no_results(self):
|
||||
# Tests that no compute services are found by host and binary.
|
||||
self.compute_sdk_client.services.return_value = []
|
||||
self.compute_client.services.return_value = []
|
||||
ex = self.assertRaises(
|
||||
exceptions.CommandError,
|
||||
self.cmd._find_service_by_host_and_binary,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
'fake-host',
|
||||
'nova-compute',
|
||||
)
|
||||
@ -610,14 +604,14 @@ class TestServiceSet(compute_fakes.TestComputev2):
|
||||
|
||||
def test_service_set_find_service_by_host_and_binary_many_results(self):
|
||||
# Tests that more than one compute service is found by host and binary.
|
||||
self.compute_sdk_client.services.return_value = [
|
||||
self.compute_client.services.return_value = [
|
||||
mock.Mock(),
|
||||
mock.Mock(),
|
||||
]
|
||||
ex = self.assertRaises(
|
||||
exceptions.CommandError,
|
||||
self.cmd._find_service_by_host_and_binary,
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
'fake-host',
|
||||
'nova-compute',
|
||||
)
|
||||
|
@ -58,7 +58,7 @@ class TestUsageList(TestUsage):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.usages.return_value = self.usages
|
||||
self.compute_client.usages.return_value = self.usages
|
||||
|
||||
self.projects_mock.list.return_value = [self.project]
|
||||
# Get the command object to test
|
||||
@ -97,7 +97,7 @@ class TestUsageList(TestUsage):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.projects_mock.list.assert_called_with()
|
||||
self.compute_sdk_client.usages.assert_called_with(
|
||||
self.compute_client.usages.assert_called_with(
|
||||
start=datetime.datetime(2016, 11, 11, 0, 0),
|
||||
end=datetime.datetime(2016, 12, 20, 0, 0),
|
||||
detailed=True,
|
||||
@ -118,7 +118,7 @@ class TestUsageList(TestUsage):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.projects_mock.list.assert_called_with()
|
||||
self.compute_sdk_client.usages.assert_has_calls(
|
||||
self.compute_client.usages.assert_has_calls(
|
||||
[mock.call(start=mock.ANY, end=mock.ANY, detailed=True)]
|
||||
)
|
||||
self.assertCountEqual(self.columns, columns)
|
||||
@ -151,7 +151,7 @@ class TestUsageShow(TestUsage):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
self.compute_sdk_client.get_usage.return_value = self.usage
|
||||
self.compute_client.get_usage.return_value = self.usage
|
||||
|
||||
self.projects_mock.get.return_value = self.project
|
||||
# Get the command object to test
|
||||
@ -194,7 +194,7 @@ class TestUsageShow(TestUsage):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
self.compute_sdk_client.get_usage.assert_called_with(
|
||||
self.compute_client.get_usage.assert_called_with(
|
||||
project=self.project.id,
|
||||
start=datetime.datetime(2016, 11, 11, 0, 0),
|
||||
end=datetime.datetime(2016, 12, 20, 0, 0),
|
||||
|
@ -73,7 +73,7 @@ class TestCreateFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
fip_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._floating_ip['pool']
|
||||
self.compute_client, self._floating_ip['pool']
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
@ -103,7 +103,7 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
fip_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._floating_ips[0]['id']
|
||||
self.compute_client, self._floating_ips[0]['id']
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
|
||||
@ -122,12 +122,8 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
|
||||
fip_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
self.compute_sdk_client, self._floating_ips[0]['id']
|
||||
),
|
||||
mock.call(
|
||||
self.compute_sdk_client, self._floating_ips[1]['id']
|
||||
),
|
||||
mock.call(self.compute_client, self._floating_ips[0]['id']),
|
||||
mock.call(self.compute_client, self._floating_ips[1]['id']),
|
||||
]
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -157,11 +153,9 @@ class TestDeleteFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
self.assertEqual('1 of 2 floating_ips failed to delete.', str(e))
|
||||
|
||||
fip_mock.assert_any_call(
|
||||
self.compute_sdk_client, self._floating_ips[0]['id']
|
||||
)
|
||||
fip_mock.assert_any_call(
|
||||
self.compute_sdk_client, 'unexist_floating_ip'
|
||||
self.compute_client, self._floating_ips[0]['id']
|
||||
)
|
||||
fip_mock.assert_any_call(self.compute_client, 'unexist_floating_ip')
|
||||
|
||||
|
||||
@mock.patch.object(compute_v2, 'list_floating_ips')
|
||||
@ -203,7 +197,7 @@ class TestListFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
fip_mock.assert_called_once_with(self.compute_sdk_client)
|
||||
fip_mock.assert_called_once_with(self.compute_client)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, list(data))
|
||||
|
||||
@ -248,7 +242,7 @@ class TestShowFloatingIPCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
fip_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._floating_ip['id']
|
||||
self.compute_client, self._floating_ip['id']
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
@ -44,6 +44,6 @@ class TestListFloatingIPPoolCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
fipp_mock.assert_called_once_with(self.compute_sdk_client)
|
||||
fipp_mock.assert_called_once_with(self.compute_client)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, list(data))
|
||||
|
@ -148,7 +148,7 @@ class TestCreateNetworkCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
net_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
subnet=self._network['cidr'],
|
||||
name=self._network['label'],
|
||||
)
|
||||
@ -182,7 +182,7 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
delete_net_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._networks[0]['id'],
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -203,8 +203,8 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
||||
|
||||
delete_net_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(self.compute_sdk_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_sdk_client, self._networks[1]['id']),
|
||||
mock.call(self.compute_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_client, self._networks[1]['id']),
|
||||
]
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -238,15 +238,15 @@ class TestDeleteNetworkCompute(compute_fakes.TestComputev2):
|
||||
|
||||
find_net_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(self.compute_sdk_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_sdk_client, 'xxxx-yyyy-zzzz'),
|
||||
mock.call(self.compute_sdk_client, self._networks[1]['id']),
|
||||
mock.call(self.compute_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_client, 'xxxx-yyyy-zzzz'),
|
||||
mock.call(self.compute_client, self._networks[1]['id']),
|
||||
]
|
||||
)
|
||||
delete_net_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(self.compute_sdk_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_sdk_client, self._networks[1]['id']),
|
||||
mock.call(self.compute_client, self._networks[0]['id']),
|
||||
mock.call(self.compute_client, self._networks[1]['id']),
|
||||
]
|
||||
)
|
||||
|
||||
@ -286,7 +286,7 @@ class TestListNetworkCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
net_mock.assert_called_once_with(self.compute_sdk_client)
|
||||
net_mock.assert_called_once_with(self.compute_client)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, list(data))
|
||||
|
||||
@ -398,7 +398,7 @@ class TestShowNetworkCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
net_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._network['label']
|
||||
self.compute_client, self._network['label']
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
@ -1378,7 +1378,7 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
||||
|
||||
def test_port_list_with_server_option(self):
|
||||
fake_server = compute_fakes.create_one_sdk_server()
|
||||
self.compute_sdk_client.find_server.return_value = fake_server
|
||||
self.compute_client.find_server.return_value = fake_server
|
||||
|
||||
arglist = [
|
||||
'--server',
|
||||
@ -1393,7 +1393,7 @@ class TestListPort(compute_fakes.FakeClientMixin, TestPort):
|
||||
self.network_client.ports.assert_called_once_with(
|
||||
device_id=fake_server.id, fields=LIST_FIELDS_TO_RETRIEVE
|
||||
)
|
||||
self.compute_sdk_client.find_server.aassert_called_once_with(
|
||||
self.compute_client.find_server.aassert_called_once_with(
|
||||
mock.ANY, 'fake-server-name'
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
|
@ -72,7 +72,7 @@ class TestCreateSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group['name'],
|
||||
self._security_group['name'],
|
||||
)
|
||||
@ -95,7 +95,7 @@ class TestCreateSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group['name'],
|
||||
self._security_group['description'],
|
||||
)
|
||||
@ -133,7 +133,7 @@ class TestDeleteSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_groups[0]['id'],
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -153,12 +153,8 @@ class TestDeleteSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
|
||||
sg_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
self.compute_sdk_client, self._security_groups[0]['id']
|
||||
),
|
||||
mock.call(
|
||||
self.compute_sdk_client, self._security_groups[1]['id']
|
||||
),
|
||||
mock.call(self.compute_client, self._security_groups[0]['id']),
|
||||
mock.call(self.compute_client, self._security_groups[1]['id']),
|
||||
]
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
@ -187,9 +183,7 @@ class TestDeleteSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
|
||||
sg_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
self.compute_sdk_client, self._security_groups[0]['id']
|
||||
),
|
||||
mock.call(self.compute_client, self._security_groups[0]['id']),
|
||||
]
|
||||
)
|
||||
|
||||
@ -250,7 +244,7 @@ class TestListSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, all_projects=False
|
||||
self.compute_client, all_projects=False
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(self.data, list(data))
|
||||
@ -267,9 +261,7 @@ class TestListSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, all_projects=True
|
||||
)
|
||||
sg_mock.assert_called_once_with(self.compute_client, all_projects=True)
|
||||
self.assertEqual(self.columns_all_projects, columns)
|
||||
self.assertCountEqual(self.data_all_projects, list(data))
|
||||
|
||||
@ -309,7 +301,7 @@ class TestSetSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._security_group['id']
|
||||
self.compute_client, self._security_group['id']
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
|
||||
@ -334,7 +326,7 @@ class TestSetSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group['id'],
|
||||
name=new_name,
|
||||
description=new_description,
|
||||
@ -394,7 +386,7 @@ class TestShowSecurityGroupCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sg_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._security_group['id']
|
||||
self.compute_client, self._security_group['id']
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertCountEqual(self.data, data)
|
||||
|
@ -159,7 +159,7 @@ class TestCreateSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sgr_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
security_group_id=self._security_group['id'],
|
||||
ip_protocol=self._security_group_rule['ip_protocol'],
|
||||
from_port=self._security_group_rule['from_port'],
|
||||
@ -202,7 +202,7 @@ class TestCreateSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sgr_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
security_group_id=self._security_group['id'],
|
||||
ip_protocol=self._security_group_rule['ip_protocol'],
|
||||
from_port=self._security_group_rule['from_port'],
|
||||
@ -240,7 +240,7 @@ class TestCreateSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sgr_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
security_group_id=self._security_group['id'],
|
||||
ip_protocol=self._security_group_rule['ip_protocol'],
|
||||
from_port=self._security_group_rule['from_port'],
|
||||
@ -279,7 +279,7 @@ class TestCreateSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
sgr_mock.assert_called_once_with(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
security_group_id=self._security_group['id'],
|
||||
ip_protocol=self._security_group_rule['ip_protocol'],
|
||||
from_port=self._security_group_rule['from_port'],
|
||||
@ -316,7 +316,7 @@ class TestDeleteSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
result = self.cmd.take_action(parsed_args)
|
||||
|
||||
sgr_mock.assert_called_once_with(
|
||||
self.compute_sdk_client, self._security_group_rules[0]['id']
|
||||
self.compute_client, self._security_group_rules[0]['id']
|
||||
)
|
||||
self.assertIsNone(result)
|
||||
|
||||
@ -335,11 +335,11 @@ class TestDeleteSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
sgr_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group_rules[0]['id'],
|
||||
),
|
||||
mock.call(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group_rules[1]['id'],
|
||||
),
|
||||
]
|
||||
@ -367,10 +367,10 @@ class TestDeleteSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
sgr_mock.assert_has_calls(
|
||||
[
|
||||
mock.call(
|
||||
self.compute_sdk_client,
|
||||
self.compute_client,
|
||||
self._security_group_rules[0]['id'],
|
||||
),
|
||||
mock.call(self.compute_sdk_client, 'unexist_rule'),
|
||||
mock.call(self.compute_client, 'unexist_rule'),
|
||||
]
|
||||
)
|
||||
|
||||
@ -457,7 +457,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
compute_v2.list_security_groups.assert_called_once_with(
|
||||
self.compute_sdk_client, all_projects=False
|
||||
self.compute_client, all_projects=False
|
||||
)
|
||||
self.assertEqual(self.expected_columns_no_group, columns)
|
||||
self.assertEqual(self.expected_data_no_group, list(data))
|
||||
@ -473,7 +473,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
compute_v2.find_security_group.assert_called_once_with(
|
||||
self.compute_sdk_client, self._security_group['id']
|
||||
self.compute_client, self._security_group['id']
|
||||
)
|
||||
self.assertEqual(self.expected_columns_with_group, columns)
|
||||
self.assertEqual(self.expected_data_with_group, list(data))
|
||||
@ -489,7 +489,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
compute_v2.list_security_groups.assert_called_once_with(
|
||||
self.compute_sdk_client, all_projects=True
|
||||
self.compute_client, all_projects=True
|
||||
)
|
||||
self.assertEqual(self.expected_columns_no_group, columns)
|
||||
self.assertEqual(self.expected_data_no_group, list(data))
|
||||
@ -505,7 +505,7 @@ class TestListSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
compute_v2.list_security_groups.assert_called_once_with(
|
||||
self.compute_sdk_client, all_projects=False
|
||||
self.compute_client, all_projects=False
|
||||
)
|
||||
self.assertEqual(self.expected_columns_no_group, columns)
|
||||
self.assertEqual(self.expected_data_no_group, list(data))
|
||||
@ -551,7 +551,7 @@ class TestShowSecurityGroupRuleCompute(compute_fakes.TestComputev2):
|
||||
columns, data = self.cmd.take_action(parsed_args)
|
||||
|
||||
compute_v2.list_security_groups.assert_called_once_with(
|
||||
self.compute_sdk_client
|
||||
self.compute_client
|
||||
)
|
||||
self.assertEqual(self.columns, columns)
|
||||
self.assertEqual(self.data, data)
|
||||
|
@ -129,10 +129,8 @@ class TestVolume(
|
||||
|
||||
# avoid circular imports by defining this manually rather than using
|
||||
# openstackclient.tests.unit.compute.v2.fakes.FakeClientMixin
|
||||
# TODO(stephenfin): Rename to 'compute_client' once all commands are
|
||||
# migrated to SDK
|
||||
self.app.client_manager.compute = mock.Mock(_compute_proxy.Proxy)
|
||||
self.compute_sdk_client = self.app.client_manager.compute
|
||||
self.compute_client = self.app.client_manager.compute
|
||||
|
||||
# avoid circular imports by defining this manually rather than using
|
||||
# openstackclient.tests.unit.image.v2.fakes.FakeClientMixin
|
||||
|
@ -61,7 +61,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
||||
self.volume_sdk_client.create_attachment.return_value = (
|
||||
self.volume_attachment.to_dict()
|
||||
)
|
||||
self.compute_sdk_client.find_server.return_value = self.server
|
||||
self.compute_client.find_server.return_value = self.server
|
||||
|
||||
self.cmd = volume_attachment.CreateVolumeAttachment(self.app, None)
|
||||
|
||||
@ -92,7 +92,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
||||
self.volume_sdk_client.find_volume.assert_called_once_with(
|
||||
self.volume.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.find_server.assert_called_once_with(
|
||||
self.compute_client.find_server.assert_called_once_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.volume_sdk_client.create_attachment.assert_called_once_with(
|
||||
@ -159,7 +159,7 @@ class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
||||
self.volume_sdk_client.find_volume.assert_called_once_with(
|
||||
self.volume.id, ignore_missing=False
|
||||
)
|
||||
self.compute_sdk_client.find_server.assert_called_once_with(
|
||||
self.compute_client.find_server.assert_called_once_with(
|
||||
self.server.id, ignore_missing=False
|
||||
)
|
||||
self.volume_sdk_client.create_attachment.assert_called_once_with(
|
||||
|
Loading…
x
Reference in New Issue
Block a user