@@ -12,7 +12,7 @@ def db_file(tmp_path):
1212 return f"{ tmp_path } /test.db"
1313
1414 @pytest .fixture
15- def mwl_storage (db_file ):
15+ def mwl_storage (self , db_file ):
1616 return MWLStorage (str (db_file ))
1717
1818 def test_call_success (self , mwl_storage , listener_payload ):
@@ -28,7 +28,16 @@ def test_call_missing_action_id(self, mwl_storage, listener_payload):
2828
2929 response = subject .call (listener_payload )
3030 assert response ["status" ] == "error"
31- assert "Missing action_id" in response ["error" ]
31+ assert response ["message" ] == "Missing key: 'action_id'"
32+
33+ def test_call_missing_accession_number (self , mwl_storage , listener_payload ):
34+ subject = CreateWorklistItem (mwl_storage )
35+
36+ del listener_payload ["parameters" ]["worklist_item" ]["accession_number" ]
37+
38+ response = subject .call (listener_payload )
39+ assert response ["status" ] == "error"
40+ assert response ["message" ] == "Missing key: 'accession_number'"
3241
3342 def test_call_existing_worklist_item (self , mwl_storage , listener_payload ):
3443 CreateWorklistItem (mwl_storage ).call (listener_payload )
@@ -44,4 +53,4 @@ def test_call_storage_exception(self, _, mwl_storage, listener_payload):
4453
4554 response = subject .call (listener_payload )
4655 assert response ["status" ] == "error"
47- assert "DB error" in response ["error " ]
56+ assert "DB error" in response ["message " ]
0 commit comments