def setUp(self): if not os.getenv("DUSTY_ALLOW_INTEGRATION_TESTS"): raise RuntimeError( "You must set the env var DUSTY_ALLOW_INTEGRATION_TESTS to run integration tests. " "This may affect your local config, do not run integration tests on your actual " "machine unless you know what you're doing!" ) self.handler = DustyClientTestingSocketHandler() client_logger.addHandler(self.handler) self.previous_config = get_config() self._clear_stdout() self.overridden_specs_path = tempfile.mkdtemp() write_default_config() save_config_value(constants.CONFIG_SETUP_KEY, True) save_config_value(constants.CONFIG_SPECS_REPO_KEY, "github.com/gamechanger/dusty-example-specs") self.tests_user = os.getenv("DUSTY_INTEGRATION_TESTS_USER", self.current_user) save_config_value(constants.CONFIG_MAC_USERNAME_KEY, self.tests_user) override_repo(get_specs_repo().remote_path, self.overridden_specs_path) self.fake_local_repo_location = "/tmp/fake-repo" self._set_up_fake_local_repo("/tmp/fake-repo") self._clear_stdout() self.exec_docker_processes = [] reset_memoize_cache()
def setUp(self): if not os.getenv('DUSTY_ALLOW_INTEGRATION_TESTS'): raise RuntimeError('You must set the env var DUSTY_ALLOW_INTEGRATION_TESTS to run integration tests. ' 'This may affect your local config, do not run integration tests on your actual ' "machine unless you know what you're doing!") self.previous_config = get_config() self._clear_stdout() self.overridden_specs_path = tempfile.mkdtemp() write_default_config() save_config_value(constants.CONFIG_SETUP_KEY, True) save_config_value(constants.CONFIG_SPECS_REPO_KEY, 'github.com/gamechanger/example-dusty-specs') save_config_value(constants.CONFIG_MAC_USERNAME_KEY, self.current_user) override_repo(get_specs_repo().remote_path, self.overridden_specs_path) self._set_up_fake_local_repo() self._clear_stdout()
def setUp(self): if not os.getenv('DUSTY_ALLOW_INTEGRATION_TESTS'): raise RuntimeError('You must set the env var DUSTY_ALLOW_INTEGRATION_TESTS to run integration tests. ' 'This may affect your local config, do not run integration tests on your actual ' "machine unless you know what you're doing!") self.handler = DustyClientTestingSocketHandler() client_logger.addHandler(self.handler) self.previous_config = get_config() self._clear_stdout() self.overridden_specs_path = tempfile.mkdtemp() write_default_config() save_config_value(constants.CONFIG_SETUP_KEY, True) save_config_value(constants.CONFIG_SPECS_REPO_KEY, 'github.com/gamechanger/dusty-example-specs') self.tests_user = os.getenv('DUSTY_INTEGRATION_TESTS_USER', self.current_user) save_config_value(constants.CONFIG_MAC_USERNAME_KEY, self.tests_user) override_repo(get_specs_repo().remote_path, self.overridden_specs_path) self.fake_local_repo_location = '/tmp/fake-repo' self._set_up_fake_local_repo('/tmp/fake-repo') self._clear_stdout() self.exec_docker_processes = [] reset_memoize_cache()
def test_save_and_get_config(self): config.save_config(self.test_config) self.assertItemsEqual(self.test_config, config.get_config())
def assertConfigValue(self, key, value): config = get_config() self.assertEqual(config[key], value)
def test_config_listvalues_returns(self): result = yaml.load(self.run_command('config listvalues')) self.assertItemsEqual(result, get_config())