@@ -72,7 +72,7 @@ async def test_relay_listener_listen(self, storage_instance, listener_payload, f
7272 )
7373 )
7474
75- def test_process_action (self , storage_instance , listener_payload ):
75+ def test_process_create_item_action (self , storage_instance , listener_payload ):
7676 subject = RelayListener (storage_instance )
7777
7878 response = subject .process_action (listener_payload )
@@ -93,6 +93,33 @@ def test_process_action(self, storage_instance, listener_payload):
9393 )
9494 )
9595
96+ def test_process_update_item_status_action (self , storage_instance , listener_payload ):
97+ subject = RelayListener (storage_instance )
98+
99+ subject .process_action (listener_payload )
100+
101+ update_payload = {
102+ "action_id" : "action-12345" ,
103+ "action_type" : "worklist.update_item_status" ,
104+ "parameters" : {"worklist_item" : {"accession_number" : "ACC999999" , "status" : "IN PROGRESS" }},
105+ }
106+
107+ response = subject .process_action (update_payload )
108+ assert response == {"accession_number" : "ACC999999" , "status" : "IN PROGRESS" }
109+
110+ storage_instance .update_status .assert_called_once_with ("ACC999999" , "IN PROGRESS" )
111+
112+ def test_process_action_missing_keys (self , storage_instance , listener_payload ):
113+ subject = RelayListener (storage_instance )
114+
115+ del listener_payload ["parameters" ]["worklist_item" ]["accession_number" ]
116+
117+ response = subject .process_action (listener_payload )
118+ assert response ["status" ] == "error"
119+ assert "Missing key" in response ["message" ]
120+
121+ storage_instance .store_worklist_item .assert_not_called ()
122+
96123 def test_process_action_invalid_type (self , storage_instance , listener_payload ):
97124 subject = RelayListener (storage_instance )
98125
0 commit comments