def test_check_config_none_key(t_config): t_config = _fill_missing_values(t_config) # The current implementation of create_config() doesn't delete t_config['credentials'] # if no secrets are present in any file. t_config['credentials'] = None messages = config.check_config(t_config, "test_path") assert "credentials needs to be defined!" in "\n".join(messages)
def test_check_config_none_key(t_config): t_config = _fill_missing_values(t_config) # The current implementation of create_config() doesn't delete t_config['credentials'] # if no secrets are present in any file. t_config['credentials'] = None messages = config.check_config(t_config, "test_path") assert "credentials needs to be defined!" in "\n".join(messages)
def test_check_config_good(t_config): for key, value in t_config.items(): if value == "...": t_config[key] = "filled_in" messages = config.check_config(t_config, "test_path") assert messages == []
def test_check_config_bad_keyring(t_config): t_config['gpg_secret_keyring'] = 'foo{}'.format( t_config['gpg_secret_keyring']) messages = config.check_config(t_config, "test_path") assert "needs to start with %(gpg_home)s/" in "\n".join(messages)
def test_check_config_invalid_type(t_config): t_config['log_dir'] = tuple(t_config['log_dir']) messages = config.check_config(t_config, "test_path") assert "log_dir: type" in "\n".join(messages)
def test_check_config_invalid_key(t_config): t_config['invalid_key_for_testing'] = 1 messages = config.check_config(t_config, "test_path") assert "Unknown key" in "\n".join(messages)
def test_check_config_good(t_config): t_config = _fill_missing_values(t_config) messages = config.check_config(t_config, "test_path") assert messages == []
def test_check_config_invalid_ids(params, t_config): t_config[params] = 'twenty-three-characters' messages = config.check_config(t_config, "test_path") assert '{} doesn\'t match "^[a-zA-Z0-9-_]{{1,22}}$" (required by Taskcluster)'.format( params) in messages
def test_check_config_missing_key(t_config): t_config = _fill_missing_values(t_config) del t_config['work_dir'] messages = config.check_config(t_config, "test_path") assert "Missing config keys {'work_dir'}" in "\n".join(messages)
def test_check_config_invalid_ids(params, t_config): t_config[params] = 'way-way-way-more-than-thirty-eight-characters' messages = config.check_config(t_config, "test_path") assert '{} doesn\'t match "^[a-zA-Z0-9-_]{{1,38}}$" (required by Taskcluster)'.format( params) in messages
def test_check_config_invalid_key(t_config): t_config['invalid_key_for_testing'] = 1 messages = config.check_config(t_config, "test_path") assert "Unknown key" in "\n".join(messages)
def test_check_config_good(t_config): t_config = _fill_missing_values(t_config) messages = config.check_config(t_config, "test_path") assert messages == []
def test_check_config_invalid_ids(params, t_config): t_config[params] = 'twenty-three-characters' messages = config.check_config(t_config, "test_path") assert '{} doesn\'t match "^[a-zA-Z0-9-_]{{1,22}}$" (required by Taskcluster)'.format(params) in messages
def test_check_config_invalid_type(t_config): t_config['log_dir'] = tuple(t_config['log_dir']) messages = config.check_config(t_config, "test_path") assert "log_dir: type" in "\n".join(messages)
def test_check_config_missing_key(t_config): t_config = _fill_missing_values(t_config) del t_config['work_dir'] messages = config.check_config(t_config, "test_path") assert "Missing config keys {'work_dir'}" in "\n".join(messages)
def test_check_config_good(self, test_config): for key, value in test_config.items(): if value == "...": test_config[key] = "filled_in" messages = config.check_config(test_config, "test_path") assert messages == []