# Path: sahara_tempest_plugin/tests/clients/base.py
# TEMPEST_CONF = config.CONF
# CLUSTER_STATUS_ACTIVE = "Active"
# CLUSTER_STATUS_ERROR = "Error"
# class ClusterErrorException(exceptions.TempestException):
# class BaseDataProcessingTest(tempest.test.BaseTestCase):
#     def resource_setup(cls):
#     def get_floating_ip_pool_id_for_neutron(cls):
#     def get_private_network_id(cls):
#     def _find_network_by_name(cls, network_name):
#     def get_image_id(cls, image_name):
#     def get_plugin(cls):
#     def create_node_group_template(self, name, **kwargs):
#     def create_cluster_template(self, name, **kwargs):
#     def create_data_source(self, name, url, description, type,
#                            credentials=None):
#     def create_job_binary(self, name, url, description, extra=None):
#     def create_job_binary_internal(self, name, data):
#     def create_job(self, name, job_type, mains, libs=None, description=None):
#     def create_cluster(self, name, **kwargs):
#     def check_cluster_active(self, cluster_id):
#     def create_job_execution(self, **kwargs):
#     def create_container(self, name):
#     def delete_resource(self, resource_client, resource_id):
#     def delete_timeout(
#             self, resource_client, resource_id,
#             timeout=TEMPEST_CONF.data_processing.cluster_timeout):
#     def delete_swift_container(self, container):


from sahara_tempest_plugin.tests.clients import base
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



class PluginsTest(base.BaseDataProcessingTest):

    def _check_plugins_list(self):
        plugins = self.client.plugins.list()
        plugins_names = [plugin.name for plugin in plugins]
        plugin = self.get_plugin()
        self.assertIn(plugin.name, plugins_names)

        return plugins_names

    def _check_plugins_get(self, plugins_names):
        for plugin_name in plugins_names:
            plugin = self.client.plugins.get(plugin_name)
            self.assertEqual(plugin_name, plugin.name)

            # check get_version_details
            for plugin_version in plugin.versions:
                detailed_plugin = self.client.plugins.get_version_details(
                    plugin_name, plugin_version)
                self.assertEqual(plugin_name, detailed_plugin.name)

                # check that required image tags contains name and version
                image_tags = detailed_plugin.required_image_tags
                self.assertIn(plugin_name, image_tags)

# Path: sahara_tempest_plugin/tests/clients/base.py
# TEMPEST_CONF = config.CONF
# CLUSTER_STATUS_ACTIVE = "Active"
# CLUSTER_STATUS_ERROR = "Error"
# class ClusterErrorException(exceptions.TempestException):
# class BaseDataProcessingTest(tempest.test.BaseTestCase):
#     def resource_setup(cls):
#     def get_floating_ip_pool_id_for_neutron(cls):
#     def get_private_network_id(cls):
#     def _find_network_by_name(cls, network_name):
#     def get_image_id(cls, image_name):
#     def get_plugin(cls):
#     def create_node_group_template(self, name, **kwargs):
#     def create_cluster_template(self, name, **kwargs):
#     def create_data_source(self, name, url, description, type,
#                            credentials=None):
#     def create_job_binary(self, name, url, description, extra=None):
#     def create_job_binary_internal(self, name, data):
#     def create_job(self, name, job_type, mains, libs=None, description=None):
#     def create_cluster(self, name, **kwargs):
#     def check_cluster_active(self, cluster_id):
#     def create_job_execution(self, **kwargs):
#     def create_container(self, name):
#     def delete_resource(self, resource_client, resource_id):
#     def delete_timeout(
#             self, resource_client, resource_id,
#             timeout=TEMPEST_CONF.data_processing.cluster_timeout):
#     def delete_swift_container(self, container):


# Path: sahara_tempest_plugin/tests/clients/test_plugins.py
from sahara_tempest_plugin.tests.clients import base

#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.



class PluginsTest(base.BaseDataProcessingTest):

    def _check_plugins_list(self):
        plugins = self.client.plugins.list()
        plugins_names = [plugin.name for plugin in plugins]
        plugin = self.get_plugin()
        self.assertIn(plugin.name, plugins_names)

        return plugins_names

    def _check_plugins_get(self, plugins_names):
        for plugin_name in plugins_names:
            plugin = self.client.plugins.get(plugin_name)
            self.assertEqual(plugin_name, plugin.name)

            # check get_version_details
            for plugin_version in plugin.versions:
                detailed_plugin = self.client.plugins.get_version_details(
                    plugin_name, plugin_version)
                self.assertEqual(plugin_name, detailed_plugin.name)

                # check that required image tags contains name and version
                image_tags = detailed_plugin.required_image_tags
                self.assertIn(plugin_name, image_tags)

                self.assertIn(plugin_version, image_tags)