Example #1
0
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)
Example #2
0
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)
Example #3
0
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 == []
Example #4
0
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)
Example #5
0
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)
Example #6
0
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)
Example #7
0
def test_check_config_good(t_config):
    t_config = _fill_missing_values(t_config)
    messages = config.check_config(t_config, "test_path")
    assert messages == []
Example #8
0
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
Example #9
0
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)
Example #10
0
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
Example #11
0
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)
Example #12
0
def test_check_config_good(t_config):
    t_config = _fill_missing_values(t_config)
    messages = config.check_config(t_config, "test_path")
    assert messages == []
Example #13
0
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
Example #14
0
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)
Example #15
0
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)
Example #16
0
 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 == []