diff options
author | Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp> | 2015-04-13 00:20:41 +0000 |
---|---|---|
committer | Ken'ichi Ohmichi <ken1ohmichi@gmail.com> | 2015-04-26 15:20:17 +0000 |
commit | 3de6d98e7104a8435e294cd31a3133ac6e1e2fcc (patch) | |
tree | 149b38fd99c0c8f54f1135bdb4799ceb62148f13 | |
parent | 11fafa6527cdb3b568418871f750219c5374724d (diff) | |
download | tempest-3de6d98e7104a8435e294cd31a3133ac6e1e2fcc.tar.gz |
Apply a naming rule of GET to compute clients(a-e)
[GET /resources] methods should be "list_<resource name>s"
or "show_<resource name>", so this patch applies the rule
to compute clients which names are "[a-e].*".
Partially implements blueprint consistent-service-method-names
Change-Id: Iaa3a295b4d7b06f7d3a7344e427eee02d0c6b96b
14 files changed, 26 insertions, 28 deletions
diff --git a/tempest/api/compute/admin/test_aggregates.py b/tempest/api/compute/admin/test_aggregates.py index 3a34a2e2e..c4cb11a99 100644 --- a/tempest/api/compute/admin/test_aggregates.py +++ b/tempest/api/compute/admin/test_aggregates.py @@ -102,7 +102,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest): aggregate = self.client.create_aggregate(name=aggregate_name) self.addCleanup(self.client.delete_aggregate, aggregate['id']) - body = self.client.get_aggregate(aggregate['id']) + body = self.client.show_aggregate(aggregate['id']) self.assertEqual(aggregate['name'], body['name']) self.assertEqual(aggregate['availability_zone'], body['availability_zone']) @@ -114,7 +114,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest): self.assertEqual(meta, body["metadata"]) # verify the metadata has been set - body = self.client.get_aggregate(aggregate['id']) + body = self.client.show_aggregate(aggregate['id']) self.assertEqual(meta, body["metadata"]) @test.attr(type='gate') @@ -198,7 +198,7 @@ class AggregatesAdminTestJSON(base.BaseV2ComputeAdminTest): self.client.add_host(aggregate['id'], self.host) self.addCleanup(self.client.remove_host, aggregate['id'], self.host) - body = self.client.get_aggregate(aggregate['id']) + body = self.client.show_aggregate(aggregate['id']) self.assertEqual(aggregate_name, body['name']) self.assertIsNone(body['availability_zone']) self.assertIn(self.host, body['hosts']) diff --git a/tempest/api/compute/admin/test_aggregates_negative.py b/tempest/api/compute/admin/test_aggregates_negative.py index f6d6ad3f8..882986c48 100644 --- a/tempest/api/compute/admin/test_aggregates_negative.py +++ b/tempest/api/compute/admin/test_aggregates_negative.py @@ -110,7 +110,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): self.addCleanup(self.client.delete_aggregate, aggregate['id']) self.assertRaises(lib_exc.Forbidden, - self.user_client.get_aggregate, + self.user_client.show_aggregate, aggregate['id']) @test.attr(type=['negative', 'gate']) @@ -125,7 +125,7 @@ class AggregatesAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): def test_aggregate_get_details_with_invalid_id(self): # Get aggregate details with invalid id should raise exceptions. self.assertRaises(lib_exc.NotFound, - self.client.get_aggregate, -1) + self.client.show_aggregate, -1) @test.attr(type=['negative', 'gate']) @test.idempotent_id('0ef07828-12b4-45ba-87cc-41425faf5711') diff --git a/tempest/api/compute/admin/test_availability_zone.py b/tempest/api/compute/admin/test_availability_zone.py index eadc15a8c..1ec171bad 100644 --- a/tempest/api/compute/admin/test_availability_zone.py +++ b/tempest/api/compute/admin/test_availability_zone.py @@ -32,12 +32,12 @@ class AZAdminV2TestJSON(base.BaseComputeAdminTest): @test.idempotent_id('d3431479-8a09-4f76-aa2d-26dc580cb27c') def test_get_availability_zone_list(self): # List of availability zone - availability_zone = self.client.get_availability_zone_list() + availability_zone = self.client.list_availability_zones() self.assertTrue(len(availability_zone) > 0) @test.attr(type='gate') @test.idempotent_id('ef726c58-530f-44c2-968c-c7bed22d5b8c') def test_get_availability_zone_list_detail(self): # List of availability zones and available services - availability_zone = self.client.get_availability_zone_list_detail() + availability_zone = self.client.list_availability_zones(detail=True) self.assertTrue(len(availability_zone) > 0) diff --git a/tempest/api/compute/admin/test_availability_zone_negative.py b/tempest/api/compute/admin/test_availability_zone_negative.py index d6e577e6b..e9de6283e 100644 --- a/tempest/api/compute/admin/test_availability_zone_negative.py +++ b/tempest/api/compute/admin/test_availability_zone_negative.py @@ -36,4 +36,4 @@ class AZAdminNegativeTestJSON(base.BaseV2ComputeAdminTest): # non-administrator user self.assertRaises( lib_exc.Forbidden, - self.non_adm_client.get_availability_zone_list_detail) + self.non_adm_client.list_availability_zones, detail=True) diff --git a/tempest/api/compute/admin/test_baremetal_nodes.py b/tempest/api/compute/admin/test_baremetal_nodes.py index 64099c391..9b8893812 100644 --- a/tempest/api/compute/admin/test_baremetal_nodes.py +++ b/tempest/api/compute/admin/test_baremetal_nodes.py @@ -52,5 +52,5 @@ class BaremetalNodesAdminTestJSON(base.BaseV2ComputeAdminTest): # Test getting each individually for node in test_nodes: - baremetal_node = self.client.get_baremetal_node(node['uuid']) + baremetal_node = self.client.show_baremetal_node(node['uuid']) self.assertEqual(node['uuid'], baremetal_node['id']) diff --git a/tempest/api/compute/certificates/test_certificates.py b/tempest/api/compute/certificates/test_certificates.py index 2be201a81..4fe87adda 100644 --- a/tempest/api/compute/certificates/test_certificates.py +++ b/tempest/api/compute/certificates/test_certificates.py @@ -33,6 +33,6 @@ class CertificatesV2TestJSON(base.BaseComputeTest): @test.idempotent_id('3ac273d0-92d2-4632-bdfc-afbc21d4606c') def test_get_root_certificate(self): # get the root certificate - body = self.certificates_client.get_certificate('root') + body = self.certificates_client.show_certificate('root') self.assertIn('data', body) self.assertIn('private_key', body) diff --git a/tempest/api/compute/servers/test_availability_zone.py b/tempest/api/compute/servers/test_availability_zone.py index f3650ac8b..8d3f31cb7 100644 --- a/tempest/api/compute/servers/test_availability_zone.py +++ b/tempest/api/compute/servers/test_availability_zone.py @@ -32,5 +32,5 @@ class AZV2TestJSON(base.BaseComputeTest): @test.idempotent_id('a8333aa2-205c-449f-a828-d38c2489bf25') def test_get_availability_zone_list_with_non_admin_user(self): # List of availability zone with non-administrator user - availability_zone = self.client.get_availability_zone_list() + availability_zone = self.client.list_availability_zones() self.assertTrue(len(availability_zone) > 0) diff --git a/tempest/api/compute/test_extensions.py b/tempest/api/compute/test_extensions.py index 5b1407195..09927fc5d 100644 --- a/tempest/api/compute/test_extensions.py +++ b/tempest/api/compute/test_extensions.py @@ -50,5 +50,5 @@ class ExtensionsTestJSON(base.BaseV2ComputeTest): @test.attr(type='gate') def test_get_extension(self): # get the specified extensions - extension = self.extensions_client.get_extension('os-consoles') + extension = self.extensions_client.show_extension('os-consoles') self.assertEqual('os-consoles', extension['alias']) diff --git a/tempest/scenario/test_aggregates_basic_ops.py b/tempest/scenario/test_aggregates_basic_ops.py index c5e80124c..b1d3418c2 100644 --- a/tempest/scenario/test_aggregates_basic_ops.py +++ b/tempest/scenario/test_aggregates_basic_ops.py @@ -80,7 +80,7 @@ class TestAggregatesBasicOps(manager.ScenarioTest): def _check_aggregate_details(self, aggregate, aggregate_name, azone, hosts, metadata): - aggregate = self.aggregates_client.get_aggregate(aggregate['id']) + aggregate = self.aggregates_client.show_aggregate(aggregate['id']) self.assertEqual(aggregate_name, aggregate['name']) self.assertEqual(azone, aggregate['availability_zone']) self.assertEqual(hosts, aggregate['hosts']) diff --git a/tempest/services/compute/json/aggregates_client.py b/tempest/services/compute/json/aggregates_client.py index 36a347bbb..6c02b6335 100644 --- a/tempest/services/compute/json/aggregates_client.py +++ b/tempest/services/compute/json/aggregates_client.py @@ -30,7 +30,7 @@ class AggregatesClientJSON(service_client.ServiceClient): self.validate_response(schema.list_aggregates, resp, body) return service_client.ResponseBodyList(resp, body['aggregates']) - def get_aggregate(self, aggregate_id): + def show_aggregate(self, aggregate_id): """Get details of the given aggregate.""" resp, body = self.get("os-aggregates/%s" % str(aggregate_id)) body = json.loads(body) @@ -67,7 +67,7 @@ class AggregatesClientJSON(service_client.ServiceClient): def is_resource_deleted(self, id): try: - self.get_aggregate(id) + self.show_aggregate(id) except lib_exc.NotFound: return True return False diff --git a/tempest/services/compute/json/availability_zone_client.py b/tempest/services/compute/json/availability_zone_client.py index 6c5039831..925d79f54 100644 --- a/tempest/services/compute/json/availability_zone_client.py +++ b/tempest/services/compute/json/availability_zone_client.py @@ -22,17 +22,15 @@ from tempest.common import service_client class AvailabilityZoneClientJSON(service_client.ServiceClient): - def get_availability_zone_list(self): - resp, body = self.get('os-availability-zone') - body = json.loads(body) - self.validate_response(schema.list_availability_zone_list, resp, body) - return service_client.ResponseBodyList(resp, - body['availabilityZoneInfo']) + def list_availability_zones(self, detail=False): + url = 'os-availability-zone' + schema_list = schema.list_availability_zone_list + if detail: + url += '/detail' + schema_list = schema.list_availability_zone_list_detail - def get_availability_zone_list_detail(self): - resp, body = self.get('os-availability-zone/detail') + resp, body = self.get(url) body = json.loads(body) - self.validate_response(schema.list_availability_zone_list_detail, resp, - body) + self.validate_response(schema_list, resp, body) return service_client.ResponseBodyList(resp, body['availabilityZoneInfo']) diff --git a/tempest/services/compute/json/baremetal_nodes_client.py b/tempest/services/compute/json/baremetal_nodes_client.py index d8bbadd0c..e4a4e8842 100644 --- a/tempest/services/compute/json/baremetal_nodes_client.py +++ b/tempest/services/compute/json/baremetal_nodes_client.py @@ -34,7 +34,7 @@ class BaremetalNodesClientJSON(service_client.ServiceClient): self.validate_response(schema.list_baremetal_nodes, resp, body) return service_client.ResponseBodyList(resp, body['nodes']) - def get_baremetal_node(self, baremetal_node_id): + def show_baremetal_node(self, baremetal_node_id): """Returns the details of a single baremetal node.""" url = 'os-baremetal-nodes/%s' % baremetal_node_id resp, body = self.get(url) diff --git a/tempest/services/compute/json/certificates_client.py b/tempest/services/compute/json/certificates_client.py index e6b72bbe7..752a48e77 100644 --- a/tempest/services/compute/json/certificates_client.py +++ b/tempest/services/compute/json/certificates_client.py @@ -21,7 +21,7 @@ from tempest.common import service_client class CertificatesClientJSON(service_client.ServiceClient): - def get_certificate(self, id): + def show_certificate(self, id): url = "os-certificates/%s" % (id) resp, body = self.get(url) body = json.loads(body) diff --git a/tempest/services/compute/json/extensions_client.py b/tempest/services/compute/json/extensions_client.py index 5c6908530..265b381ea 100644 --- a/tempest/services/compute/json/extensions_client.py +++ b/tempest/services/compute/json/extensions_client.py @@ -33,7 +33,7 @@ class ExtensionsClientJSON(service_client.ServiceClient): exts = extensions['extensions'] return any([e for e in exts if e['name'] == extension]) - def get_extension(self, extension_alias): + def show_extension(self, extension_alias): resp, body = self.get('extensions/%s' % extension_alias) body = json.loads(body) return service_client.ResponseBody(resp, body['extension']) |