test list/remove secret

This commit is contained in:
Jörg Thalheim
2023-08-02 11:36:49 +02:00
committed by Mic92
parent 8ee073668f
commit dab483339a
5 changed files with 63 additions and 48 deletions

View File

@@ -114,7 +114,17 @@ def test_secrets(
with mock_env(
SOPS_NIX_SECRET="foo", SOPS_AGE_KEY_FILE=str(clan_flake / ".." / "age.key")
):
cli.run(["set", "nonexisting"])
cli.run(["set", "key"])
capsys.readouterr()
cli.run(["get", "nonexisting"])
cli.run(["get", "key"])
assert capsys.readouterr().out == "foo"
capsys.readouterr() # empty the buffer
cli.run(["list"])
assert capsys.readouterr().out == "key\n"
cli.run(["remove", "key"])
capsys.readouterr() # empty the buffer
cli.run(["list"])
assert capsys.readouterr().out == ""