Updated database clients for bp client-checks-success
Updated the client to handle response status and removed the
response status checks from tests
Partially Implements blueprint: client-checks-success
Change-Id: I0d246a57dcb4b6bdec83a0a678cac418c64ff4dd
diff --git a/tempest/api/database/flavors/test_flavors.py b/tempest/api/database/flavors/test_flavors.py
index 64d71b9..999e8ca 100644
--- a/tempest/api/database/flavors/test_flavors.py
+++ b/tempest/api/database/flavors/test_flavors.py
@@ -27,8 +27,7 @@
@test.attr(type='smoke')
def test_get_db_flavor(self):
# The expected flavor details should be returned
- resp, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
- self.assertEqual(200, resp.status)
+ _, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
self.assertEqual(self.db_flavor_ref, str(flavor['id']))
self.assertIn('ram', flavor)
self.assertIn('links', flavor)
@@ -36,11 +35,9 @@
@test.attr(type='smoke')
def test_list_db_flavors(self):
- resp, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
- self.assertEqual(200, resp.status)
+ _, flavor = self.client.get_db_flavor_details(self.db_flavor_ref)
# List of all flavors should contain the expected flavor
- resp, flavors = self.client.list_db_flavors()
- self.assertEqual(200, resp.status)
+ _, flavors = self.client.list_db_flavors()
self.assertIn(flavor, flavors)
def _check_values(self, names, db_flavor, os_flavor, in_db=True):
@@ -56,17 +53,14 @@
@test.attr(type='smoke')
def test_compare_db_flavors_with_os(self):
- resp, db_flavors = self.client.list_db_flavors()
- self.assertEqual(200, resp.status)
- resp, os_flavors = self.os_flavors_client.list_flavors_with_detail()
- self.assertEqual(200, resp.status)
+ _, db_flavors = self.client.list_db_flavors()
+ _, os_flavors = self.os_flavors_client.list_flavors_with_detail()
self.assertEqual(len(os_flavors), len(db_flavors),
"OS flavors %s do not match DB flavors %s" %
(os_flavors, db_flavors))
for os_flavor in os_flavors:
- resp, db_flavor =\
+ _, db_flavor =\
self.client.get_db_flavor_details(os_flavor['id'])
- self.assertEqual(200, resp.status)
self._check_values(['id', 'name', 'ram'], db_flavor, os_flavor)
self._check_values(['disk', 'vcpus', 'swap'], db_flavor, os_flavor,
in_db=False)
diff --git a/tempest/api/database/versions/test_versions.py b/tempest/api/database/versions/test_versions.py
index 6101f47..453abe7 100644
--- a/tempest/api/database/versions/test_versions.py
+++ b/tempest/api/database/versions/test_versions.py
@@ -27,8 +27,7 @@
@test.attr(type='smoke')
def test_list_db_versions(self):
- resp, versions = self.client.list_db_versions()
- self.assertEqual(200, resp.status)
+ _, versions = self.client.list_db_versions()
self.assertTrue(len(versions) > 0, "No database versions found")
# List of all versions should contain the current version, and there
# should only be one 'current' version
diff --git a/tempest/services/database/json/flavors_client.py b/tempest/services/database/json/flavors_client.py
index 2ec0405..f276a45 100644
--- a/tempest/services/database/json/flavors_client.py
+++ b/tempest/services/database/json/flavors_client.py
@@ -33,8 +33,10 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
def get_db_flavor_details(self, db_flavor_id):
resp, body = self.get("flavors/%s" % str(db_flavor_id))
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)
diff --git a/tempest/services/database/json/versions_client.py b/tempest/services/database/json/versions_client.py
index 0269c43..81c0e6c 100644
--- a/tempest/services/database/json/versions_client.py
+++ b/tempest/services/database/json/versions_client.py
@@ -35,4 +35,5 @@
url += '?%s' % urllib.urlencode(params)
resp, body = self.get(url)
+ self.expected_success(200, resp.status)
return resp, self._parse_resp(body)