Skip to content

Commit ee95b1f

Browse files
committed
Check we can get a list of invocations
This is a bonus extra test, to stop the coverage diff being negative after deleting FileManager.
1 parent 537c57d commit ee95b1f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/test_action_manager.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from temp_client import poll_task
55
import time
66
import labthings_fastapi as lt
7+
from labthings_fastapi.actions import ACTION_INVOCATIONS_PATH
78

89

910
class TestThing(lt.Thing):
@@ -31,7 +32,7 @@ def run(payload=None):
3132
return run
3233

3334

34-
def test_expiry():
35+
def test_action_expires():
3536
with TestClient(server.app) as client:
3637
before_value = client.get("/thing/counter").json()
3738
r = client.post("/thing/increment_counter")
@@ -42,5 +43,17 @@ def test_expiry():
4243
after_value = client.get("/thing/counter").json()
4344
assert after_value == before_value + 2
4445
invocation["status"] = "running" # Force an extra poll
46+
# When the second action runs, the first one should expire
47+
# so polling it again should give a 404.
4548
with pytest.raises(httpx.HTTPStatusError):
4649
poll_task(client, invocation)
50+
51+
52+
def test_actions_list():
53+
with TestClient(server.app) as client:
54+
r = client.post("/thing/increment_counter")
55+
invocation = poll_task(client, r.json())
56+
r2 = client.get(ACTION_INVOCATIONS_PATH)
57+
r2.raise_for_status()
58+
invocations = r2.json()
59+
assert invocations == [invocation]

0 commit comments

Comments
 (0)