-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(watcher): scanning a managed workspace only logs a warning msg
- Loading branch information
1 parent
16eeb32
commit 5f0e15a
Showing
2 changed files
with
25 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
from fastapi import FastAPI | ||
from starlette.testclient import TestClient | ||
|
||
from antarest.core.tasks.model import TaskStatus | ||
|
||
def test_integration_xpansion(app: FastAPI, tmp_path: str): | ||
client = TestClient(app, raise_server_exceptions=False) | ||
|
||
def test_integration_watcher(app: FastAPI, tmp_path: str): | ||
client = TestClient(app) | ||
res = client.post( | ||
"/v1/login", json={"username": "admin", "password": "admin"} | ||
) | ||
admin_credentials = res.json() | ||
headers = {"Authorization": f'Bearer {admin_credentials["access_token"]}'} | ||
|
||
client.post( | ||
f"/v1/watcher/_scan", | ||
headers=headers, | ||
) | ||
client.post( | ||
f"/v1/watcher/_scan?path=/tmp", | ||
res = client.post("/v1/watcher/_scan", headers=headers) | ||
assert res.status_code == 422 | ||
assert res.json() == { | ||
"description": "field required", | ||
"exception": "RequestValidationError", | ||
"body": None, | ||
} | ||
|
||
task_id = client.post( | ||
"/v1/watcher/_scan?path=/default", | ||
headers=headers, | ||
) | ||
).json() | ||
|
||
# asserts that scanning default workspace doesn't fail | ||
res = client.get( | ||
f"v1/tasks/{task_id}?wait_for_completion=true", headers=headers | ||
).json() | ||
assert res["status"] == TaskStatus.COMPLETED.value |