clan-cli: Fix some type errors in tests
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
from dataclasses import dataclass, field
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
from typing import Any, Literal
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -128,7 +128,7 @@ def test_simple_field_missing() -> None:
|
||||
class Person:
|
||||
name: str
|
||||
|
||||
person_dict = {}
|
||||
person_dict: Any = {}
|
||||
|
||||
with pytest.raises(ClanError):
|
||||
from_dict(Person, person_dict)
|
||||
@@ -151,7 +151,7 @@ def test_nullable_non_exist() -> None:
|
||||
class Person:
|
||||
name: None
|
||||
|
||||
person_dict = {}
|
||||
person_dict: Any = {}
|
||||
|
||||
with pytest.raises(ClanError):
|
||||
from_dict(Person, person_dict)
|
||||
|
||||
@@ -61,7 +61,7 @@ def test_add_module_to_inventory(
|
||||
]
|
||||
)
|
||||
create_machine(
|
||||
FlakeId(base_path),
|
||||
FlakeId(str(base_path)),
|
||||
Machine(
|
||||
name="machine1", tags=[], system="x86_64-linux", deploy=MachineDeploy()
|
||||
),
|
||||
|
||||
@@ -48,7 +48,9 @@ def test_generate_secret(
|
||||
)
|
||||
cmd = ["facts", "generate", "--flake", str(test_flake_with_core.path), "vm1"]
|
||||
cli.run(cmd)
|
||||
store1 = SecretStore(Machine(name="vm1", flake=FlakeId(test_flake_with_core.path)))
|
||||
store1 = SecretStore(
|
||||
Machine(name="vm1", flake=FlakeId(str(test_flake_with_core.path)))
|
||||
)
|
||||
|
||||
assert store1.exists("", "age.key")
|
||||
assert store1.exists("", "zerotier-identity-secret")
|
||||
|
||||
@@ -4,17 +4,17 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import pytest
|
||||
from age_keys import SopsSetup
|
||||
from fixtures_flakes import generate_flake
|
||||
from helpers import cli
|
||||
from helpers.nixos_config import nested_dict
|
||||
from root import CLAN_CORE
|
||||
|
||||
from clan_cli.clan_uri import FlakeId
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.nix import nix_shell
|
||||
from clan_cli.vars.public_modules import in_repo
|
||||
from clan_cli.vars.secret_modules import password_store, sops
|
||||
from tests.age_keys import SopsSetup
|
||||
from tests.fixtures_flakes import generate_flake
|
||||
from tests.helpers import cli
|
||||
from tests.helpers.nixos_config import nested_dict
|
||||
from tests.root import CLAN_CORE
|
||||
|
||||
|
||||
def test_get_subgraph() -> None:
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from tests.age_keys import SopsSetup
|
||||
from tests.fixtures_flakes import generate_flake
|
||||
from tests.helpers import cli
|
||||
from tests.helpers.nixos_config import nested_dict
|
||||
from tests.helpers.vms import qga_connect, run_vm_in_thread, wait_vm_down
|
||||
from tests.root import CLAN_CORE
|
||||
from age_keys import SopsSetup
|
||||
from fixtures_flakes import generate_flake
|
||||
from helpers import cli
|
||||
from helpers.nixos_config import nested_dict
|
||||
from helpers.vms import qga_connect, run_vm_in_thread, wait_vm_down
|
||||
from root import CLAN_CORE
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
|
||||
@@ -3,16 +3,15 @@ from pathlib import Path
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import pytest
|
||||
from fixtures_flakes import FlakeForTest, generate_flake
|
||||
from helpers import cli
|
||||
from helpers.nixos_config import nested_dict
|
||||
from helpers.vms import qga_connect, qmp_connect, run_vm_in_thread, wait_vm_down
|
||||
from root import CLAN_CORE
|
||||
from stdout import CaptureOutput
|
||||
|
||||
from tests.fixtures_flakes import FlakeForTest, generate_flake
|
||||
from tests.helpers import cli
|
||||
from tests.helpers.nixos_config import nested_dict
|
||||
from tests.helpers.vms import qga_connect, qmp_connect, run_vm_in_thread, wait_vm_down
|
||||
from tests.root import CLAN_CORE
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from tests.age_keys import KeyPair
|
||||
from age_keys import KeyPair
|
||||
|
||||
no_kvm = not os.path.exists("/dev/kvm")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user