Merge "Test is_default for share type and share group type"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 0517c60..c24a50e 100644
--- a/manila_tempest_tests/config.py
+++ b/manila_tempest_tests/config.py
@@ -30,7 +30,7 @@
                help="The minimum api microversion is configured to be the "
                     "value of the minimum microversion supported by Manila."),
     cfg.StrOpt("max_api_microversion",
-               default="2.45",
+               default="2.46",
                help="The maximum api microversion is configured to be the "
                     "value of the latest microversion supported by Manila."),
     cfg.StrOpt("region",
diff --git a/manila_tempest_tests/tests/api/admin/test_share_group_types.py b/manila_tempest_tests/tests/api/admin/test_share_group_types.py
index c0c9a97..c08448b 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_group_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_group_types.py
@@ -21,9 +21,12 @@
 
 from manila_tempest_tests.common import constants
 from manila_tempest_tests.tests.api import base
+from manila_tempest_tests import utils
 
 CONF = config.CONF
 
+LATEST_MICROVERSION = CONF.share.max_api_microversion
+
 
 @testtools.skipUnless(
     CONF.share.run_share_group_tests, 'Share Group tests disabled.')
@@ -243,3 +246,42 @@
         # List projects that have access for share group type - none expected
         access = self.shares_v2_client.list_access_to_share_group_type(sgt_id)
         self.assertEmpty(access)
+
+    @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+    @ddt.data(*set(('2.45', '2.46', LATEST_MICROVERSION)))
+    def test_share_group_type_create_show_list_with_is_default_key(self,
+                                                                   version):
+        self.skip_if_microversion_not_supported(version)
+        name = data_utils.rand_name("tempest-manila")
+
+        # Create share group type
+        sg_type_c = self.create_share_group_type(
+            name=name,
+            share_types=self.share_type['id'],
+            cleanup_in_class=False,
+            version=version)
+        if utils.is_microversion_ge(version, '2.46'):
+            self.assertIn('is_default', sg_type_c)
+            self.assertIs(False, sg_type_c['is_default'])
+        else:
+            self.assertNotIn('is_default', sg_type_c)
+
+        # List share group type
+        sg_type_list = self.shares_v2_client.list_share_group_types(
+            version=version)
+        for sg_type_get in sg_type_list:
+            if utils.is_microversion_ge(version, '2.46'):
+                self.assertIn('is_default', sg_type_get)
+                self.assertTrue(sg_type_get['is_default'] in (True, False))
+            else:
+                self.assertNotIn('is_default', sg_type_get)
+
+        # Show share group type
+        sg_type_id = sg_type_c['id']
+        sg_type_show = self.shares_v2_client.get_share_group_type(
+            sg_type_id, version=version)
+        if utils.is_microversion_ge(version, '2.46'):
+            self.assertIn('is_default', sg_type_show)
+            self.assertIs(False, sg_type_show['is_default'])
+        else:
+            self.assertNotIn('is_default', sg_type_show)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_types.py b/manila_tempest_tests/tests/api/admin/test_share_types.py
index dfa9fe7..f06c70d 100644
--- a/manila_tempest_tests/tests/api/admin/test_share_types.py
+++ b/manila_tempest_tests/tests/api/admin/test_share_types.py
@@ -24,6 +24,8 @@
 
 CONF = config.CONF
 
+LATEST_MICROVERSION = CONF.share.max_api_microversion
+
 
 @ddt.ddt
 class ShareTypesAdminTest(base.BaseSharesAdminTest):
@@ -205,3 +207,43 @@
         # List projects that have access for share type - none expected
         access = self.shares_v2_client.list_access_to_share_type(st_id)
         self.assertEmpty(access)
+
+    @tc.attr(base.TAG_POSITIVE, base.TAG_API)
+    @ddt.data(*set(('2.45', '2.46', LATEST_MICROVERSION)))
+    def test_share_type_create_show_list_with_is_default_key(self, version):
+        self.skip_if_microversion_not_supported(version)
+        name = data_utils.rand_name("tempest-manila")
+        extra_specs = self.add_extra_specs_to_dict()
+
+        # Create share type
+        st_create = self.create_share_type(
+            name, extra_specs=extra_specs, version=version)['share_type']
+
+        if utils.is_microversion_ge(version, '2.46'):
+            self.assertIn('is_default', st_create)
+            self.assertIs(False, st_create['is_default'])
+        else:
+            self.assertNotIn('is_default', st_create)
+
+        # list share types
+        st_list = self.shares_v2_client.list_share_types(version=version)
+        for st_get in st_list['share_types']:
+            if utils.is_microversion_ge(version, '2.46'):
+                self.assertIn('is_default', st_get)
+                if st_create['id'] == st_get['id']:
+                    self.assertIs(False, st_get['is_default'])
+                else:
+                    self.assertTrue(st_get['is_default'] in (True, False))
+            else:
+                self.assertNotIn('is_default', st_get)
+
+        # show share types
+        st_id = st_create['id']
+        st_show = self.shares_v2_client.get_share_type(
+            st_id, version=version)['share_type']
+
+        if utils.is_microversion_ge(version, '2.46'):
+            self.assertIn('is_default', st_show)
+            self.assertIs(False, st_show['is_default'])
+        else:
+            self.assertNotIn('is_default', st_show)