api/flake/history: implement review requests

This commit is contained in:
DavHau
2023-11-17 18:26:44 +07:00
parent bf2b8b4cca
commit c46638f589
5 changed files with 15 additions and 32 deletions

View File

@@ -11,11 +11,11 @@ from clan_cli.dirs import user_history_file
log = logging.getLogger(__name__)
def test_flake_add(
def test_flake_history_append(
api: TestClient, test_flake: FlakeForTest, temporary_home: Path
) -> None:
response = api.put(
f"/api/flake/add?flake_dir={str(test_flake.path)}",
response = api.post(
f"/api/flake/history?flake_dir={str(test_flake.path)}",
json={},
)
assert response.status_code == 200, response.json()
@@ -23,25 +23,25 @@ def test_flake_add(
assert open(user_history_file()).read().strip() == str(test_flake.path)
def test_flake_list(
def test_flake_history_list(
api: TestClient, test_flake: FlakeForTest, temporary_home: Path
) -> None:
response = api.get(
"/api/flake/list_history",
"/api/flake/history",
)
assert response.status_code == 200, response.text
assert response.json() == []
# add the test_flake
response = api.put(
f"/api/flake/add?flake_dir={str(test_flake.path)}",
response = api.post(
f"/api/flake/history?flake_dir={str(test_flake.path)}",
json={},
)
assert response.status_code == 200, response.text
# list the flakes again
response = api.get(
"/api/flake/list_history",
"/api/flake/history",
)
assert response.status_code == 200, response.text
assert response.json() == [str(test_flake.path)]