@@ -129,7 +129,7 @@ def test_process_record_demographics_mismatch_skips_update(self):
129129
130130 # Assert
131131 self .assertEqual (result ["status" ], "success" )
132- self .assertIn ( "update skipped" , result ["message" ])
132+ self .assertEqual ( result ["message" ], "Not all IEDS items matched PDS demographics; update skipped" )
133133
134134 def test_invalid_body_parsing_returns_error (self ):
135135 """When body is a malformed string, process_record should return an error"""
@@ -182,8 +182,8 @@ def test_update_called_on_match(self):
182182 self .mock_pds_get_patient_details .return_value = {
183183 "name" : [
184184 {
185- "given" : ["Tom " ],
186- "family" : "Hanks " }
185+ "given" : ["Sarah " ],
186+ "family" : "Fowley " }
187187 ],
188188 "gender" : "male" ,
189189 "birthDate" : "1956-07-09"
@@ -194,7 +194,7 @@ def test_update_called_on_match(self):
194194 "contained" : [{
195195 "resourceType" : "Patient" ,
196196 "id" : "PatM" ,
197- "name" : [{"given" : ["Tom " ], "family" : "Hanks " }],
197+ "name" : [{"given" : ["Sarah " ], "family" : "Fowley " }],
198198 "gender" : "male" , "birthDate" : "1956-07-09" }
199199 ]}
200200 }
@@ -215,8 +215,6 @@ def test_process_record_no_records_exist(self):
215215 # Act
216216 result = process_record (test_record )
217217
218- # Assert
219- self .assertEqual (result ["status" ], "success" )
220218 self .assertEqual (result ["message" ], f"No records returned for ID: { test_id } " )
221219
222220 # Verify PDS was not called
@@ -307,15 +305,16 @@ def test_process_record_birthdate_mismatch_skips_update(self):
307305 "family" : "Doe"
308306 }],
309307 "gender" : "male" ,
310- "birthDate" : "1980-01-02" }
308+ "birthDate" : "1980-01-02"
309+ }
311310 ]
312311 }
313312 }
314313 self .mock_get_items_from_patient_id .return_value = [item ]
315314
316315 result = process_record (test_sqs_record )
317316 self .assertEqual (result ["status" ], "success" )
318- self .assertIn ( "update skipped" , result ["message" ])
317+ self .assertEqual ( result ["message" ], "Not all IEDS items matched PDS demographics; update skipped" )
319318
320319 def test_process_record_gender_mismatch_skips_update (self ):
321320 """If gender differs between PDS and IEDS, update should be skipped"""
@@ -342,14 +341,17 @@ def test_process_record_gender_mismatch_skips_update(self):
342341 "given" : ["Alex" ],
343342 "family" : "Smith"
344343 }],
345- "gender" : "male" , "birthDate" : "1992-03-03" }
344+ "gender" : "male" ,
345+ "birthDate" : "1992-03-03"
346+ }
346347 ]
347- }}
348+ }
349+ }
348350 self .mock_get_items_from_patient_id .return_value = [item ]
349351
350352 result = process_record (test_sqs_record )
351353 self .assertEqual (result ["status" ], "success" )
352- self .assertIn ( "update skipped" , result ["message" ])
354+ self .assertEqual ( result ["message" ], "Not all IEDS items matched PDS demographics; update skipped" )
353355
354356 def test_process_record_no_comparable_fields_skips_update (self ):
355357 """If PDS provides no comparable fields, do not update (skip)"""
@@ -373,11 +375,13 @@ def test_process_record_no_comparable_fields_skips_update(self):
373375 "family" : "Lee"
374376 }],
375377 "gender" : "female" ,
376- "birthDate" : "2000-01-01" }
378+ "birthDate" : "2000-01-01"
379+ }
377380 ]
378- }}
381+ }
382+ }
379383 self .mock_get_items_from_patient_id .return_value = [item ]
380384
381385 result = process_record (test_sqs_record )
382386 self .assertEqual (result ["status" ], "success" )
383- self .assertIn ( "update skipped" , result ["message" ])
387+ self .assertEqual ( result ["message" ], "Not all IEDS items matched PDS demographics; update skipped" )
0 commit comments