Use _parse_resp method from tempest

As a continuation of the patch [1]. The required change
was merged in tempest. So we can make the cleanup in
manila_tempest_plugin.

[1] https://review.opendev.org/c/openstack/manila-tempest-plugin/+/836877

Change-Id: I093be875910ef18deebe3e56b83c6992d1a307e5
diff --git a/manila_tempest_tests/services/share/json/shares_client.py b/manila_tempest_tests/services/share/json/shares_client.py
index 1e3aa6e..6871eda 100644
--- a/manila_tempest_tests/services/share/json/shares_client.py
+++ b/manila_tempest_tests/services/share/json/shares_client.py
@@ -23,7 +23,6 @@
 from tempest.lib import exceptions
 
 from manila_tempest_tests import share_exceptions
-from manila_tempest_tests import utils
 
 
 CONF = config.CONF
@@ -43,8 +42,9 @@
         self.share_network_id = CONF.share.share_network_id
         self.share_size = CONF.share.share_size
 
-    def _parse_resp(self, body, verify_top_key=None):
-        return utils._parse_resp(body, verify_top_key=verify_top_key)
+    def _parse_resp(self, body, top_key_to_verify=None):
+        return super(SharesClient, self)._parse_resp(
+            body, top_key_to_verify=top_key_to_verify)
 
     def create_share(self, share_protocol=None, size=None,
                      name=None, snapshot_id=None, description=None,
@@ -450,7 +450,7 @@
     def get_metadata_item(self, share_id, key):
         resp, body = self.get("shares/%s/metadata/%s" % (share_id, key))
         self.expected_success(200, resp.status)
-        return self._parse_resp(body, verify_top_key='meta')
+        return self._parse_resp(body, top_key_to_verify='meta')
 
 ###############
 
diff --git a/manila_tempest_tests/utils.py b/manila_tempest_tests/utils.py
index 29d6096..5ecfb36 100644
--- a/manila_tempest_tests/utils.py
+++ b/manila_tempest_tests/utils.py
@@ -14,7 +14,6 @@
 #    under the License.
 
 from collections import OrderedDict
-import json
 import random
 import re
 
@@ -226,43 +225,3 @@
         headers = EXPERIMENTAL
         extra_headers = True
     return headers, extra_headers
-
-
-def _parse_resp(body, verify_top_key=None):
-    try:
-        body = json.loads(body)
-    except ValueError:
-        return body
-
-    # We assume, that if the first value of the deserialized body's
-    # item set is a dict or a list, that we just return the first value
-    # of deserialized body.
-    # Essentially "cutting out" the first placeholder element in a body
-    # that looks like this:
-    #
-    #  {
-    #    "users": [
-    #      ...
-    #    ]
-    #  }
-    try:
-        # Ensure there are not more than one top-level keys
-        # NOTE(freerunner): Ensure, that JSON is not nullable to
-        # to prevent StopIteration Exception
-        if not hasattr(body, "keys") or len(body.keys()) != 1:
-            return body
-        # Just return the "wrapped" element
-        first_key, first_item = tuple(body.items())[0]
-        if isinstance(first_item, (dict, list)):
-            if verify_top_key is not None:
-                assert_msg = (
-                    "The expected top level key is '%(top_key)s' but we "
-                    "found '%(actual_key)s'." % {
-                        'top_key': verify_top_key,
-                        'actual_key': first_key
-                    })
-                assert verify_top_key == first_key, assert_msg
-            return first_item
-    except (ValueError, IndexError):
-        pass
-    return body