From 0bf32fadd85d5938ae29d489efdd82e2cd137300 Mon Sep 17 00:00:00 2001 From: Max Nanis Date: Thu, 26 Feb 2026 15:51:49 -0500 Subject: Passing Managers into flow tasks for better pytest usage. Conftests broken out into seperate fixture files. Extensive type hinting. --- tests/http/test_notifications.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/http/test_notifications.py') diff --git a/tests/http/test_notifications.py b/tests/http/test_notifications.py index 4386863..508b236 100644 --- a/tests/http/test_notifications.py +++ b/tests/http/test_notifications.py @@ -8,6 +8,7 @@ from uuid import uuid4 from jb.config import JB_EVENTS_STREAM, settings from jb.models.event import MTurkEvent from jb.models.hit import Hit +from jb.models.assignment import AssignmentStub class TestNotifications: @@ -74,11 +75,18 @@ class TestNotifications: == assignment_stub_record.amt_assignment_id ) + # Confirm the stream is empty + assert redis.xlen(JB_EVENTS_STREAM) == 0 + res = await client.post( url=f"/{settings.sns_path}/", json=mturk_event_body_record ) res.raise_for_status() + # Now that we POSTed, confirm the stream has 1 event in it + # Confirm the stream is empty + assert redis.xlen(JB_EVENTS_STREAM) == 1 + # AMT SNS needs to receive a 200 response to stop retrying the notification assert res.status_code == 200 assert res.json() == {"status": "ok"} @@ -89,6 +97,9 @@ class TestNotifications: msg_id, msg = msg_res redis.xdel(JB_EVENTS_STREAM, msg_id) + # After running xdel, we can confirm the stream is empty + assert redis.xlen(JB_EVENTS_STREAM) == 0 + msg_json = msg["data"] event = MTurkEvent.model_validate_json(msg_json) -- cgit v1.2.3