add show default group type details and unit test
add show default group type detail api to v3 group types client
Change-Id: I52e2382db7046f233ee03a1e3f79c6f2296cba85
diff --git a/releasenotes/notes/add-show-default-group-type-detail-api-to-v3-group-types-client-65f717878cf52da0.yaml b/releasenotes/notes/add-show-default-group-type-detail-api-to-v3-group-types-client-65f717878cf52da0.yaml
new file mode 100644
index 0000000..1419e66
--- /dev/null
+++ b/releasenotes/notes/add-show-default-group-type-detail-api-to-v3-group-types-client-65f717878cf52da0.yaml
@@ -0,0 +1,6 @@
+---
+features:
+ - |
+ Add show default group type details API to v3 group_types_client library.
+
+ * show_default_group_type
diff --git a/tempest/lib/services/volume/v3/group_types_client.py b/tempest/lib/services/volume/v3/group_types_client.py
index 1ccb9f8..5170595 100644
--- a/tempest/lib/services/volume/v3/group_types_client.py
+++ b/tempest/lib/services/volume/v3/group_types_client.py
@@ -63,6 +63,18 @@
self.expected_success(200, resp.status)
return rest_client.ResponseBody(resp, body)
+ def show_default_group_type(self):
+ """Returns the details of default group_type.
+
+ For more information, please refer to the official API reference:
+ https://developer.openstack.org/api-ref/block-storage/v3/#show-default-group-type-details
+ """
+ url = 'group_types/default'
+ resp, body = self.get(url)
+ body = json.loads(body)
+ self.expected_success(200, resp.status)
+ return rest_client.ResponseBody(resp, body)
+
def show_group_type(self, group_type_id):
"""Returns the details of a single group_type.
diff --git a/tempest/tests/lib/services/volume/v3/test_group_types_client.py b/tempest/tests/lib/services/volume/v3/test_group_types_client.py
index c60cc36..a333b81 100644
--- a/tempest/tests/lib/services/volume/v3/test_group_types_client.py
+++ b/tempest/tests/lib/services/volume/v3/test_group_types_client.py
@@ -40,6 +40,16 @@
}
}
+ FAKE_INFO_DEFAULT_GROUP_TYPE = {
+ "group_type": {
+ "id": "7270c56e-6354-4528-8e8b-f54dee2232c8",
+ "name": "group-type-default",
+ "description": "default group type",
+ "is_public": True,
+ "group_specs": {},
+ }
+ }
+
FAKE_LIST_GROUP_TYPES = {
"group_types": [
{
@@ -114,6 +124,13 @@
bytes_body,
group_type_id="3fbbcccf-d058-4502-8844-6feeffdf4cb5")
+ def _test_show_default_group_type(self, bytes_body=False):
+ self.check_service_client_function(
+ self.client.show_default_group_type,
+ 'tempest.lib.common.rest_client.RestClient.get',
+ self.FAKE_INFO_DEFAULT_GROUP_TYPE,
+ bytes_body)
+
def _test_list_group_types(self, bytes_body=False):
self.check_service_client_function(
self.client.list_group_types,
@@ -192,6 +209,12 @@
def test_show_group_type_with_bytes_body(self):
self._test_show_group_type(bytes_body=True)
+ def test_show_default_group_type_with_str_body(self):
+ self._test_show_default_group_type()
+
+ def test_show_default_group_type_with_bytes_body(self):
+ self._test_show_default_group_type(bytes_body=True)
+
def test_list_group_types_with_str_body(self):
self._test_list_group_types()