diff --git a/pkgs/clan-cli/tests/test_vms_api.py b/pkgs/clan-cli/tests/test_vms_api.py index 32b74576c..02bf655db 100644 --- a/pkgs/clan-cli/tests/test_vms_api.py +++ b/pkgs/clan-cli/tests/test_vms_api.py @@ -1,10 +1,15 @@ import os from pathlib import Path +from typing import TYPE_CHECKING import pytest from api import TestClient +from cli import Cli from httpx import SyncByteStream +if TYPE_CHECKING: + from age_keys import KeyPair + @pytest.mark.impure def test_inspect(api: TestClient, test_flake_with_core: Path) -> None: @@ -33,7 +38,16 @@ def test_incorrect_uuid(api: TestClient) -> None: @pytest.mark.skipif(not os.path.exists("/dev/kvm"), reason="Requires KVM") @pytest.mark.impure -def test_create(api: TestClient, test_flake_with_core: Path) -> None: +def test_create( + api: TestClient, + monkeypatch: pytest.MonkeyPatch, + test_flake_with_core: Path, + age_keys: list["KeyPair"], +) -> None: + monkeypatch.chdir(test_flake_with_core) + monkeypatch.setenv("SOPS_AGE_KEY", age_keys[0].privkey) + cli = Cli() + cli.run(["secrets", "users", "add", "user1", age_keys[0].pubkey]) print(f"flake_url: {test_flake_with_core} ") response = api.post( "/api/vms/create",