# Path: sahara_tempest_plugin/tests/api/base.py
# CONF = config.CONF
# class InvalidSaharaTestConfiguration(exceptions.TempestException):
# class BaseDataProcessingTest(tempest.test.BaseTestCase):
#     def skip_checks(cls):
#     def setup_clients(cls):
#     def resource_setup(cls):
#     def resource_cleanup(cls):
#     def cleanup_resources(resource_id_list, method):
#     def create_node_group_template(cls, name, plugin_name, hadoop_version,
#                                    node_processes, flavor_id,
#                                    node_configs=None, **kwargs):
#     def create_cluster_template(cls, name, plugin_name, hadoop_version,
#                                 node_groups, cluster_configs=None, **kwargs):
#     def create_data_source(cls, name, type, url, **kwargs):
#     def create_job_binary_internal(cls, name, data):
#     def create_job_binary(cls, name, url, extra=None, **kwargs):
#     def create_job(cls, name, job_type, mains, libs=None, **kwargs):
#     def create_job_template(cls, name, job_type, mains, libs=None, **kwargs):
#     def get_node_group_template(cls, nodegroup='worker1'):
#     def get_cluster_template(cls, node_group_template_ids=None):
#     def wait_for_resource_deletion(cls, resource_id, get_resource):
#         def is_resource_deleted(resource_id):


from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from sahara_tempest_plugin.tests.api import base as dp_base
#         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.





class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
    # NOTE: Links to the API documentation: https://docs.openstack.org/
    # api-ref/data-processing/v1.1/#cluster-templates
    # https://docs.openstack.org/api-ref/data-processing/v2/#cluster-templates

    @classmethod
    def skip_checks(cls):
        super(ClusterTemplateTest, cls).skip_checks()
        if cls.default_plugin is None:
            raise cls.skipException("No Sahara plugins configured")

    @classmethod
    def resource_setup(cls):
        super(ClusterTemplateTest, cls).resource_setup()

        # pre-define a node group templates
        node_group_template_w = cls.get_node_group_template('worker1')
        if node_group_template_w is None:

# Path: sahara_tempest_plugin/tests/api/base.py
# CONF = config.CONF
# class InvalidSaharaTestConfiguration(exceptions.TempestException):
# class BaseDataProcessingTest(tempest.test.BaseTestCase):
#     def skip_checks(cls):
#     def setup_clients(cls):
#     def resource_setup(cls):
#     def resource_cleanup(cls):
#     def cleanup_resources(resource_id_list, method):
#     def create_node_group_template(cls, name, plugin_name, hadoop_version,
#                                    node_processes, flavor_id,
#                                    node_configs=None, **kwargs):
#     def create_cluster_template(cls, name, plugin_name, hadoop_version,
#                                 node_groups, cluster_configs=None, **kwargs):
#     def create_data_source(cls, name, type, url, **kwargs):
#     def create_job_binary_internal(cls, name, data):
#     def create_job_binary(cls, name, url, extra=None, **kwargs):
#     def create_job(cls, name, job_type, mains, libs=None, **kwargs):
#     def create_job_template(cls, name, job_type, mains, libs=None, **kwargs):
#     def get_node_group_template(cls, nodegroup='worker1'):
#     def get_cluster_template(cls, node_group_template_ids=None):
#     def wait_for_resource_deletion(cls, resource_id, get_resource):
#         def is_resource_deleted(resource_id):


# Path: sahara_tempest_plugin/tests/api/test_cluster_templates.py
from testtools import testcase as tc
from tempest.lib import decorators
from tempest.lib.common.utils import data_utils
from sahara_tempest_plugin.tests.api import base as dp_base

#         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.





class ClusterTemplateTest(dp_base.BaseDataProcessingTest):
    # NOTE: Links to the API documentation: https://docs.openstack.org/
    # api-ref/data-processing/v1.1/#cluster-templates
    # https://docs.openstack.org/api-ref/data-processing/v2/#cluster-templates

    @classmethod
    def skip_checks(cls):
        super(ClusterTemplateTest, cls).skip_checks()
        if cls.default_plugin is None:
            raise cls.skipException("No Sahara plugins configured")

    @classmethod
    def resource_setup(cls):
        super(ClusterTemplateTest, cls).resource_setup()

        # pre-define a node group templates
        node_group_template_w = cls.get_node_group_template('worker1')
        if node_group_template_w is None:

            raise dp_base.InvalidSaharaTestConfiguration(