Merge "Replace six.iteritems() with .items()"
diff --git a/manila_tempest_tests/config.py b/manila_tempest_tests/config.py
index 1c1735d..9314da0 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.22",
+ default="2.23",
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_type_filter.py b/manila_tempest_tests/tests/api/admin/test_share_type_filter.py
new file mode 100644
index 0000000..e34f943
--- /dev/null
+++ b/manila_tempest_tests/tests/api/admin/test_share_type_filter.py
@@ -0,0 +1,55 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import ddt
+from tempest.lib.common.utils import data_utils
+from testtools import testcase as tc
+
+from manila_tempest_tests.tests.api import base
+
+
+@ddt.ddt
+class ShareTypeFilterTest(base.BaseSharesAdminTest):
+
+ @classmethod
+ def _create_share_type(cls):
+ name = data_utils.rand_name("unique_st_name")
+ extra_specs = cls.add_required_extra_specs_to_dict()
+ return cls.create_share_type(
+ name, extra_specs=extra_specs,
+ client=cls.admin_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(ShareTypeFilterTest, cls).resource_setup()
+ cls.admin_client = cls.shares_v2_client
+ cls.st = cls._create_share_type()
+
+ @tc.attr(base.TAG_POSITIVE, base.TAG_API_WITH_BACKEND)
+ @base.skip_if_microversion_not_supported("2.23")
+ @ddt.data(True, False)
+ def test_get_pools_with_share_type_filter_with_detail(self, detail):
+ share_type = self.st["share_type"]["id"]
+ search_opts = {"share_type": share_type}
+ kwargs = {'search_opts': search_opts}
+
+ if detail:
+ kwargs.update({'detail': True})
+
+ pools = self.admin_client.list_pools(**kwargs)['pools']
+ for pool in pools:
+ pool_keys = pool.keys()
+ self.assertIn("name", pool_keys)
+ self.assertIn("host", pool_keys)
+ self.assertIn("backend", pool_keys)
+ self.assertIn("pool", pool_keys)
+ self.assertIs(detail, "capabilities" in pool_keys)
diff --git a/manila_tempest_tests/tests/api/admin/test_share_type_filter_negative.py b/manila_tempest_tests/tests/api/admin/test_share_type_filter_negative.py
new file mode 100644
index 0000000..80f8d66
--- /dev/null
+++ b/manila_tempest_tests/tests/api/admin/test_share_type_filter_negative.py
@@ -0,0 +1,54 @@
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import ddt
+from oslo_utils import uuidutils
+from tempest import config
+from tempest.lib.common.utils import data_utils
+from testtools import testcase as tc
+
+from manila_tempest_tests.tests.api import base
+
+CONF = config.CONF
+
+
+@ddt.ddt
+class ShareTypeFilterNegativeTest(base.BaseSharesAdminTest):
+
+ @classmethod
+ def _create_share_type(cls):
+ name = data_utils.rand_name("unique_st_name")
+ extra_specs = {
+ 'share_backend_name': uuidutils.generate_uuid(),
+ }
+ extra_specs = cls.add_required_extra_specs_to_dict(
+ extra_specs=extra_specs)
+ return cls.create_share_type(
+ name, extra_specs=extra_specs,
+ client=cls.admin_client)
+
+ @classmethod
+ def resource_setup(cls):
+ super(ShareTypeFilterNegativeTest, cls).resource_setup()
+ cls.admin_client = cls.shares_v2_client
+ cls.st = cls._create_share_type()
+
+ @tc.attr(base.TAG_NEGATIVE, base.TAG_API_WITH_BACKEND)
+ @base.skip_if_microversion_not_supported("2.23")
+ @ddt.data(True, False)
+ def test_get_pools_invalid_share_type_filter_with_detail(self, detail):
+ share_type = self.st["share_type"]["name"]
+ search_opts = {"share_type": share_type}
+ pools = self.admin_client.list_pools(
+ detail=detail, search_opts=search_opts)['pools']
+
+ self.assertEmpty(pools)