api/machines: allow config verification on imaginary machines

Machines do not need to exist in order to verify their configuration.

This allows verifying a config before creating an actual machine with it.
This commit is contained in:
DavHau
2023-11-13 21:24:05 +07:00
parent 1b357c412d
commit d755048dc2
3 changed files with 43 additions and 7 deletions

View File

@@ -62,6 +62,18 @@ def test_create_machine_invalid_hostname(
)
@pytest.mark.with_core
def test_verify_config_without_machine(
api: TestClient, test_flake_with_core: FlakeForTest
) -> None:
response = api.put(
f"/api/{test_flake_with_core.name}/machines/test/verify",
json=dict(),
)
assert response.status_code == 200
assert response.json() == {"success": True, "error": None}
@pytest.mark.with_core
def test_configure_machine(api: TestClient, test_flake_with_core: FlakeForTest) -> None:
# ensure error 404 if machine does not exist when accessing the config