api/flake/add: init
Adds an endpoint to memoize clans. clan flakes can be added to the history either via the endpoint or by executing `clan flakes add`
This commit is contained in:
@@ -4,10 +4,25 @@ import logging
|
||||
import pytest
|
||||
from api import TestClient
|
||||
from fixtures_flakes import FlakeForTest
|
||||
from path import Path
|
||||
|
||||
from clan_cli.dirs import user_history_file
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def test_flake_add(
|
||||
api: TestClient, test_flake: FlakeForTest, temporary_home: Path
|
||||
) -> None:
|
||||
response = api.put(
|
||||
f"/api/flake/add?flake_dir={str(test_flake.path)}",
|
||||
json={},
|
||||
)
|
||||
assert response.status_code == 200, response.json()
|
||||
assert user_history_file().exists()
|
||||
assert open(user_history_file()).read().strip() == str(test_flake.path)
|
||||
|
||||
|
||||
@pytest.mark.impure
|
||||
def test_inspect_ok(api: TestClient, test_flake_with_core: FlakeForTest) -> None:
|
||||
params = {"url": str(test_flake_with_core.path)}
|
||||
|
||||
Reference in New Issue
Block a user