# Path: sahara_tests/version.py



import os
import sys
import pkg_resources as pkg
import testtools
from jsonschema import exceptions
from unittest import mock
from sahara_tests import version
from sahara_tests.scenario import runner
        project_name = os.environ.get('OS_PROJECT_NAME', '')
        os.environ['OS_USERNAME'] = 'demo_env'
        os.environ['OS_PASSWORD'] = 'demopwd_env'
        os.environ['OS_AUTH_URL'] = 'http://localhost:5000/v2.0'
        os.environ['OS_PROJECT_NAME'] = 'project_env'
        sys.argv = ['sahara_tests/scenario/runner.py',
                    '-V',
                    'sahara_tests/unit/scenario/templatevars_complete.ini',
                    '-p', 'spark', '-v', '1.3.1', '--release', 'liberty',
                    '--count', '4']
        runner.main()
        expected = {
            'os_username': 'demo_env',
            'os_password': 'demopwd_env',
            'os_tenant': 'project_env',
            'os_auth_url': 'http://localhost:5000/v2.0'
        }
        self.assertTrue(self._isDictContainSubset(
            expected, mock_validate.call_args_list[0][0][0]['credentials']))

        os.environ['OS_USERNAME'] = username
        os.environ['OS_PASSWORD'] = password
        os.environ['OS_AUTHURL'] = auth_url
        os.environ['OS_PROJECT_NAME'] = project_name

    @mock.patch('sahara_tests.scenario.validation.validate')
    @mock.patch('subprocess.Popen',
                return_value=_create_subprocess_communicate_mock())
    @mock.patch('sys.exit', return_value=None)
    def test_credentials_clouds(self, mock_sys, mock_sub, mock_validate):

# Path: sahara_tests/version.py



# Path: sahara_tests/unit/scenario/test_runner.py
import os
import sys
import pkg_resources as pkg
import testtools
from jsonschema import exceptions
from unittest import mock
from sahara_tests import version
from sahara_tests.scenario import runner

        project_name = os.environ.get('OS_PROJECT_NAME', '')
        os.environ['OS_USERNAME'] = 'demo_env'
        os.environ['OS_PASSWORD'] = 'demopwd_env'
        os.environ['OS_AUTH_URL'] = 'http://localhost:5000/v2.0'
        os.environ['OS_PROJECT_NAME'] = 'project_env'
        sys.argv = ['sahara_tests/scenario/runner.py',
                    '-V',
                    'sahara_tests/unit/scenario/templatevars_complete.ini',
                    '-p', 'spark', '-v', '1.3.1', '--release', 'liberty',
                    '--count', '4']
        runner.main()
        expected = {
            'os_username': 'demo_env',
            'os_password': 'demopwd_env',
            'os_tenant': 'project_env',
            'os_auth_url': 'http://localhost:5000/v2.0'
        }
        self.assertTrue(self._isDictContainSubset(
            expected, mock_validate.call_args_list[0][0][0]['credentials']))

        os.environ['OS_USERNAME'] = username
        os.environ['OS_PASSWORD'] = password
        os.environ['OS_AUTHURL'] = auth_url
        os.environ['OS_PROJECT_NAME'] = project_name

    @mock.patch('sahara_tests.scenario.validation.validate')
    @mock.patch('subprocess.Popen',
                return_value=_create_subprocess_communicate_mock())
    @mock.patch('sys.exit', return_value=None)
    def test_credentials_clouds(self, mock_sys, mock_sub, mock_validate):

        unit_dir = pkg.resource_filename(version.version_info.package,