api/schema: return list of missing modules
This commit is contained in:
@@ -30,13 +30,28 @@ def test_schema_errors(api: TestClient, test_flake_with_core: FlakeForTest) -> N
|
||||
json={"imports": ["some-inavlid-import"]},
|
||||
)
|
||||
assert response.status_code == 422
|
||||
# expect error to contain "error: string 'some-inavlid-import' doesn't represent an absolute path"
|
||||
assert (
|
||||
"error: string 'some-inavlid-import' doesn't represent an absolute path"
|
||||
in response.json()["detail"][0]["msg"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.with_core
|
||||
def test_schema_invalid_clan_imports(
|
||||
api: TestClient, test_flake_with_core: FlakeForTest
|
||||
) -> None:
|
||||
response = api.put(
|
||||
f"/api/{test_flake_with_core.name}/schema",
|
||||
json={"clanImports": ["non-existing-clan-module"]},
|
||||
)
|
||||
assert response.status_code == 400
|
||||
assert (
|
||||
"Some requested clan modules could not be found"
|
||||
in response.json()["detail"]["msg"]
|
||||
)
|
||||
assert "non-existing-clan-module" in response.json()["detail"]["modules_not_found"]
|
||||
|
||||
|
||||
@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
|
||||
|
||||
Reference in New Issue
Block a user