Fix T110 violation for database client

T110 requires methods, which calls GET, should be "list_<resource>s"
or "show_<resource>" as these names for consistency.
In addition, the other service clients doesn't contain "_details" on
the method names.
So this patch renames get_db_flavor_details to show_db_flavor on
database client.

Partially implements blueprint consistent-service-method-names

Change-Id: Ia0b509ad9c4413c3ea9910e06d7c60c0c4f6896e
This commit is contained in:
Ken'ichi Ohmichi 2015-12-07 05:05:41 +00:00
parent d88f3a34dd
commit 096592fa2b
4 changed files with 6 additions and 7 deletions

View File

@ -28,7 +28,7 @@ class DatabaseFlavorsTest(base.BaseDatabaseTest):
@test.idempotent_id('c94b825e-0132-4686-8049-8a4a2bc09525')
def test_get_db_flavor(self):
# The expected flavor details should be returned
flavor = (self.client.get_db_flavor_details(self.db_flavor_ref)
flavor = (self.client.show_db_flavor(self.db_flavor_ref)
['flavor'])
self.assertEqual(self.db_flavor_ref, str(flavor['id']))
self.assertIn('ram', flavor)
@ -38,7 +38,7 @@ class DatabaseFlavorsTest(base.BaseDatabaseTest):
@test.attr(type='smoke')
@test.idempotent_id('685025d6-0cec-4673-8a8d-995cb8e0d3bb')
def test_list_db_flavors(self):
flavor = (self.client.get_db_flavor_details(self.db_flavor_ref)
flavor = (self.client.show_db_flavor(self.db_flavor_ref)
['flavor'])
# List of all flavors should contain the expected flavor
flavors = self.client.list_db_flavors()['flavors']
@ -67,7 +67,7 @@ class DatabaseFlavorsTest(base.BaseDatabaseTest):
(os_flavors, db_flavors))
for os_flavor in os_flavors:
db_flavor =\
self.client.get_db_flavor_details(os_flavor['id'])['flavor']
self.client.show_db_flavor(os_flavor['id'])['flavor']
self._check_values(['id', 'name', 'ram'], db_flavor, os_flavor)
self._check_values(['disk', 'vcpus', 'swap'], db_flavor, os_flavor,
in_db=False)

View File

@ -31,4 +31,4 @@ class DatabaseFlavorsNegativeTest(base.BaseDatabaseTest):
def test_get_non_existent_db_flavor(self):
# flavor details are not returned for non-existent flavors
self.assertRaises(lib_exc.NotFound,
self.client.get_db_flavor_details, -1)
self.client.show_db_flavor, -1)

View File

@ -1,4 +1,3 @@
./tempest/services/database/json/flavors_client.py
./tempest/services/identity/v3/json/identity_client.py
./tempest/services/identity/v3/json/policy_client.py
./tempest/services/messaging/json/messaging_client.py

View File

@ -31,8 +31,8 @@ class DatabaseFlavorsClient(service_client.ServiceClient):
body = json.loads(body)
return service_client.ResponseBody(resp, body)
def get_db_flavor_details(self, db_flavor_id):
resp, body = self.get("flavors/%s" % str(db_flavor_id))
def show_db_flavor(self, db_flavor_id):
resp, body = self.get("flavors/%s" % db_flavor_id)
self.expected_success(200, resp.status)
body = json.loads(body)
return service_client.ResponseBody(resp, body)