# Path: sahara_tests/scenario/utils.py
# SCENARIO_RESOURCES_DIR = pkg.resource_filename(version.version_info.package,
#                                                'scenario')
# TEST_TEMPLATE_DIR = os.path.join(SCENARIO_RESOURCES_DIR, 'defaults/')
# DEFAULT_TEMPLATE_VARS = [os.path.join(TEST_TEMPLATE_DIR,
#                                       'credentials.yaml.mako'),
#                          os.path.join(TEST_TEMPLATE_DIR,
#                                       'edp.yaml.mako')]
# TEST_TEMPLATE_PATH = os.path.join(SCENARIO_RESOURCES_DIR,
#                                   'testcase.py.mako')
# DEFAULT_STESTR_CONF = os.path.join(SCENARIO_RESOURCES_DIR, 'stestr.conf')
# def rand_name(name=''):
# def run_tests(concurrency, test_dir_path):
# def create_testcase_file(testcases, credentials, network, report,
#                          use_api_v2=False):
# def get_templates_variables(files, variable_file, verbose_run, scenario_args,
#                             auth_values):
# def generate_config(files, template_variables, auth_values, verbose_run,
#                     features_list=None):
# def get_default_templates(plugin, version, release, scenario_arguments,
#                           features=None):
# def get_auth_values(cloud_config, args):
# def _merge_dicts_sections(dict_with_section, dict_for_merge, section):
# def is_template_file(config_file):
# def read_template_variables(variable_file=None, verbose=False,
#                             scenario_args=None, auth_values=None):
# def read_scenario_config(scenario_config, template_vars=None,
#                          verbose=False):


import os
import testtools
from unittest import mock
from sahara_tests.scenario import utils
        when the plugin does not require versions and
        there are no features specified."""
        found_templates = utils.get_default_templates('fake', None, None,
                                                      ['conffile.yaml'])
        expected_templates = (
            utils.DEFAULT_TEMPLATE_VARS +
            [os.path.join(utils.TEST_TEMPLATE_DIR, 'fake.yaml.mako'),
             'conffile.yaml']
        )
        self.assertListEqual(found_templates, expected_templates)

    def test_get_default_templates_missingversion(self):
        """Check the list of automatically discovered templates
        when the plugin requires a version but it was not specified."""
        self.assertRaises(ValueError, utils.get_default_templates,
                          'vanilla', None, None, ['conffile.yaml'])

    @mock.patch('os.path.exists', side_effect=[True, False, True, True])
    def test_get_default_templates_version_release_features(self, m_exist):
        """Check the list of automatically discovered templates
        when the plugin requires a version, a release is specified and
        there are features specified."""
        found_templates = utils.get_default_templates('vanilla', '2.7.1',
                                                      'rocky',
                                                      ['conffile.yaml'],
                                                      ['feat1', 'feat2'])
        expected_templates = (
            utils.DEFAULT_TEMPLATE_VARS +
            [os.path.join(utils.TEST_TEMPLATE_DIR, 'rocky',
                          'vanilla-2.7.1.yaml.mako'),

# Path: sahara_tests/scenario/utils.py
# SCENARIO_RESOURCES_DIR = pkg.resource_filename(version.version_info.package,
#                                                'scenario')
# TEST_TEMPLATE_DIR = os.path.join(SCENARIO_RESOURCES_DIR, 'defaults/')
# DEFAULT_TEMPLATE_VARS = [os.path.join(TEST_TEMPLATE_DIR,
#                                       'credentials.yaml.mako'),
#                          os.path.join(TEST_TEMPLATE_DIR,
#                                       'edp.yaml.mako')]
# TEST_TEMPLATE_PATH = os.path.join(SCENARIO_RESOURCES_DIR,
#                                   'testcase.py.mako')
# DEFAULT_STESTR_CONF = os.path.join(SCENARIO_RESOURCES_DIR, 'stestr.conf')
# def rand_name(name=''):
# def run_tests(concurrency, test_dir_path):
# def create_testcase_file(testcases, credentials, network, report,
#                          use_api_v2=False):
# def get_templates_variables(files, variable_file, verbose_run, scenario_args,
#                             auth_values):
# def generate_config(files, template_variables, auth_values, verbose_run,
#                     features_list=None):
# def get_default_templates(plugin, version, release, scenario_arguments,
#                           features=None):
# def get_auth_values(cloud_config, args):
# def _merge_dicts_sections(dict_with_section, dict_for_merge, section):
# def is_template_file(config_file):
# def read_template_variables(variable_file=None, verbose=False,
#                             scenario_args=None, auth_values=None):
# def read_scenario_config(scenario_config, template_vars=None,
#                          verbose=False):


# Path: sahara_tests/unit/scenario/test_utils.py
import os
import testtools
from unittest import mock
from sahara_tests.scenario import utils

        when the plugin does not require versions and
        there are no features specified."""
        found_templates = utils.get_default_templates('fake', None, None,
                                                      ['conffile.yaml'])
        expected_templates = (
            utils.DEFAULT_TEMPLATE_VARS +
            [os.path.join(utils.TEST_TEMPLATE_DIR, 'fake.yaml.mako'),
             'conffile.yaml']
        )
        self.assertListEqual(found_templates, expected_templates)

    def test_get_default_templates_missingversion(self):
        """Check the list of automatically discovered templates
        when the plugin requires a version but it was not specified."""
        self.assertRaises(ValueError, utils.get_default_templates,
                          'vanilla', None, None, ['conffile.yaml'])

    @mock.patch('os.path.exists', side_effect=[True, False, True, True])
    def test_get_default_templates_version_release_features(self, m_exist):
        """Check the list of automatically discovered templates
        when the plugin requires a version, a release is specified and
        there are features specified."""
        found_templates = utils.get_default_templates('vanilla', '2.7.1',
                                                      'rocky',
                                                      ['conffile.yaml'],
                                                      ['feat1', 'feat2'])
        expected_templates = (
            utils.DEFAULT_TEMPLATE_VARS +
            [os.path.join(utils.TEST_TEMPLATE_DIR, 'rocky',
                          'vanilla-2.7.1.yaml.mako'),

             os.path.join(utils.TEST_TEMPLATE_DIR,