clan-cli: tests: call SopsSetup.init while setting up fixtures

We do this by introducing `flake_with_sops` fixture, that calls the
init method ahead of the test. We did not want to do this in the `flake`
fixture since not all tests using the `flake` fixture need to have sops
setup.
This commit is contained in:
Louis Opter
2025-03-18 18:22:56 +00:00
committed by Mic92
parent dbcb8d6a4c
commit c02f19205f
4 changed files with 42 additions and 50 deletions

View File

@@ -51,21 +51,14 @@ def test_machine_subcommands(
assert "vm2" in output.out
# louis(2025-03-09):
#
# The `with_core` mark is cargo-culted from
# `test_generate_public_and_secret_vars` which
# I used as a starting point:
@pytest.mark.with_core
def test_machine_delete(
monkeypatch: pytest.MonkeyPatch,
flake: fixtures_flakes.ClanFlake,
flake_with_sops: fixtures_flakes.ClanFlake,
sops_setup: SopsSetup,
) -> None:
# create the admin user and set its key:
sops_setup.init(flake.path)
flake = flake_with_sops
# admin_key, machine_key, machine2_key = age_keys
admin_key, machine_key, machine2_key = sops_setup.keys
# create a couple machines with their keys