api/machines: add test ensuring empty config is valid
This commit is contained in:
parent
ace0ae5c49
commit
2dcdf738ce
@ -25,11 +25,11 @@ def test_schema_errors(api: TestClient, test_flake_with_core: FlakeForTest) -> N
|
||||
# make sure that eval errors do not raise an internal server error
|
||||
response = api.put(
|
||||
f"/api/{test_flake_with_core.name}/schema",
|
||||
json={"imports": ["some-inavlid-import"]},
|
||||
json={"imports": ["some-invalid-import"]},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
assert (
|
||||
"error: string 'some-inavlid-import' doesn't represent an absolute path"
|
||||
"error: string 'some-invalid-import' doesn't represent an absolute path"
|
||||
in response.json()["detail"][0]["msg"]
|
||||
)
|
||||
|
||||
@ -74,6 +74,21 @@ def test_verify_config_without_machine(
|
||||
assert response.json() == {"success": True, "error": None}
|
||||
|
||||
|
||||
@pytest.mark.with_core
|
||||
def test_ensure_empty_config_is_valid(
|
||||
api: TestClient, test_flake_with_core: FlakeForTest
|
||||
) -> None:
|
||||
response = api.put(
|
||||
f"/api/{test_flake_with_core.name}/machines/test/config",
|
||||
json=dict(),
|
||||
)
|
||||
assert response.status_code == 200
|
||||
|
||||
response = api.get(f"/api/{test_flake_with_core.name}/machines/test/verify")
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user