Merge "Fix credential client to return raw response"
diff --git a/tempest/api/identity/admin/v3/test_credentials.py b/tempest/api/identity/admin/v3/test_credentials.py
index 12b236f..a0d8748 100644
--- a/tempest/api/identity/admin/v3/test_credentials.py
+++ b/tempest/api/identity/admin/v3/test_credentials.py
@@ -12,6 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_serialization import jsonutils as json
from tempest.api.identity import base
from tempest.common.utils import data_utils
@@ -70,6 +71,7 @@
update_body = self.creds_client.update_credential(
cred['id'], blob=blob, project_id=self.projects[1],
type='ec2')['credential']
+ update_body['blob'] = json.loads(update_body['blob'])
self.assertEqual(cred['id'], update_body['id'])
self.assertEqual(self.projects[1], update_body['project_id'])
self.assertEqual(self.user_body['id'], update_body['user_id'])
@@ -77,6 +79,7 @@
self.assertEqual(update_body['blob']['secret'], new_keys[1])
get_body = self.creds_client.show_credential(cred['id'])['credential']
+ get_body['blob'] = json.loads(get_body['blob'])
for value1 in self.creds_list[0]:
self.assertEqual(update_body[value1],
get_body[value1])
diff --git a/tempest/lib/services/identity/v3/credentials_client.py b/tempest/lib/services/identity/v3/credentials_client.py
index 8c04d2c..6e5fd31 100644
--- a/tempest/lib/services/identity/v3/credentials_client.py
+++ b/tempest/lib/services/identity/v3/credentials_client.py
@@ -37,7 +37,6 @@
resp, body = self.post('credentials', post_body)
self.expected_success(201, resp.status)
body = json.loads(body)
- body['credential']['blob'] = json.loads(body['credential']['blob'])
return rest_client.ResponseBody(resp, body)
def update_credential(self, credential_id, **kwargs):
@@ -51,7 +50,6 @@
resp, body = self.patch('credentials/%s' % credential_id, post_body)
self.expected_success(200, resp.status)
body = json.loads(body)
- body['credential']['blob'] = json.loads(body['credential']['blob'])
return rest_client.ResponseBody(resp, body)
def show_credential(self, credential_id):
@@ -64,7 +62,6 @@
resp, body = self.get('credentials/%s' % credential_id)
self.expected_success(200, resp.status)
body = json.loads(body)
- body['credential']['blob'] = json.loads(body['credential']['blob'])
return rest_client.ResponseBody(resp, body)
def list_credentials(self, **params):
diff --git a/tempest/tests/lib/services/base.py b/tempest/tests/lib/services/base.py
index 3165689..a244aa2 100644
--- a/tempest/tests/lib/services/base.py
+++ b/tempest/tests/lib/services/base.py
@@ -12,7 +12,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import copy
from oslo_serialization import jsonutils as json
from oslotest import mockpatch
@@ -32,7 +31,7 @@
def check_service_client_function(self, function, function2mock,
body, to_utf=False, status=200,
- headers=None, cr_blob=False, **kwargs):
+ headers=None, **kwargs):
mocked_response = self.create_response(body, to_utf, status, headers)
self.useFixture(mockpatch.Patch(
function2mock, return_value=mocked_response))
@@ -40,11 +39,4 @@
resp = function(**kwargs)
else:
resp = function()
-
- if cr_blob:
- evaluated_body = copy.deepcopy(body)
- nested_json = json.loads(evaluated_body['credential']['blob'])
- evaluated_body['credential']['blob'] = nested_json
- self.assertEqual(evaluated_body, resp)
- else:
- self.assertEqual(body, resp)
+ self.assertEqual(body, resp)
diff --git a/tempest/tests/lib/services/identity/v3/test_credentials_client.py b/tempest/tests/lib/services/identity/v3/test_credentials_client.py
index a2a22ff..29d7496 100644
--- a/tempest/tests/lib/services/identity/v3/test_credentials_client.py
+++ b/tempest/tests/lib/services/identity/v3/test_credentials_client.py
@@ -121,14 +121,14 @@
self.client.create_credential,
'tempest.lib.common.rest_client.RestClient.post',
self.FAKE_CREATE_CREDENTIAL,
- bytes_body, status=201, cr_blob=True)
+ bytes_body, status=201)
def _test_show_credential(self, bytes_body=False):
self.check_service_client_function(
self.client.show_credential,
'tempest.lib.common.rest_client.RestClient.get',
self.FAKE_INFO_CREDENTIAL,
- bytes_body, cr_blob=True,
+ bytes_body,
credential_id="207e9b76935efc03804d3dd6ab52d22e9b22a0711e4ada4f")
def _test_update_credential(self, bytes_body=False):
@@ -136,7 +136,7 @@
self.client.update_credential,
'tempest.lib.common.rest_client.RestClient.patch',
self.FAKE_INFO_CREDENTIAL,
- bytes_body, cr_blob=True,
+ bytes_body,
credential_id="207e9b76935efc03804d3dd6ab52d22e9b22a0711e4ada4f")
def _test_list_credentials(self, bytes_body=False):