Ejemplo n.º 1
0
def test_args_env_plus_cli_unseal(mock_unseal_env_vault, unseal_cli_args):
    args = vault_init.parse_args(unseal_cli_args)
    assert args["vault_addr"] == "http://clihost:8200"
    assert "test_cli_keys1" in args["keys"]
    assert "test_cli_keys2" in args["keys"]
    assert "test_env_keys1" in args["keys"]
    assert "test_env_keys2" in args["keys"]
    assert not args["can_init"]
Ejemplo n.º 2
0
def test_good_env_vars_full(mock_full_env_vault):
    args = vault_init.parse_args([])
    assert args["key_share"] == 2
    assert args["key_threshold"] == 1

    assert args["root_token_gpg"] == "-- ROOT PGP --"
    assert args["vault_addr"] == "http://monkeyhost:8200"
    assert "test_env_keys1" in args["keys"]
    assert "test_env_keys2" in args["keys"]

    assert "-- ENV KEYS PGP 1 --" in args["gpgs"]
    assert "-- ENV KEYS PGP 2 --" in args["gpgs"]

    assert args["can_init"]
Ejemplo n.º 3
0
def test_args_cli_full(full_cli_args):
    args = vault_init.parse_args(full_cli_args)
    assert args["key_share"] == 3
    assert args["key_threshold"] == 2

    assert args["root_token_gpg"] == "-- CLI ROOT PGP --"
    assert args["vault_addr"] == "http://clihost:8200"

    assert "test_cli_keys1" in args["keys"]
    assert "test_cli_keys2" in args["keys"]

    assert "-- CLI KEYS PGP 1 --" in args["gpgs"]
    assert "-- CLI KEYS PGP 2 --" in args["gpgs"]
    assert "-- CLI KEYS PGP 3 --" in args["gpgs"]

    assert args["can_init"]
Ejemplo n.º 4
0
def test_good_env_vars_unseal(mock_unseal_env_vault):
    args = vault_init.parse_args([])
    assert args["vault_addr"] == "http://monkeyhost:8200"
    assert "test_env_keys1" in args["keys"]
    assert "test_env_keys2" in args["keys"]
    assert not args["can_init"]
Ejemplo n.º 5
0
def test_args_env_full_wrong_gpg_keys(mock_full_env_missing_one_gpgs_vault):
    with pytest.raises(ValueError):
        vault_init.parse_args([])
Ejemplo n.º 6
0
def test_args_cli_full_wrong_gpg_keys(full_cli_missing_one_gpgs_args):
    with pytest.raises(ValueError):
        vault_init.parse_args(full_cli_missing_one_gpgs_args)