Skip to content

Commit 06384ce

Browse files
authored
u[date MNS method to handle duplicate NHS numbers (#1396)
1 parent 304096e commit 06384ce

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/e2e_automation/features/batchTests/Steps/batch_common_steps.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def mns_event_will_be_triggered_for_batch_record(context, action, valid_rows):
553553
null_nhs_rows = [row for row in valid_rows if _is_null_nhs_row(row)]
554554
positive_rows = [row for row in valid_rows if not _is_null_nhs_row(row)]
555555

556-
row_lookup = {str(row.NHS_NUMBER): row for row in positive_rows}
556+
row_lookup = {(str(row.NHS_NUMBER), row.IMMS_ID_CLEAN): row for row in positive_rows}
557557

558558
messages = read_messages_for_batch(
559559
context,
@@ -563,15 +563,16 @@ def mns_event_will_be_triggered_for_batch_record(context, action, valid_rows):
563563
)
564564

565565
print(f"Read {len(messages)} {action} message(s) from SQS")
566-
567566
assert messages, f"Expected at least one {action} message but queue returned empty"
568567

569568
for msg in messages:
570569
nhs = msg.subject
570+
imms_id = msg.dataref.split("/")[-1]
571+
key = (nhs, imms_id)
571572

572-
assert nhs in row_lookup, f"Received message for NHS {nhs} but it does not exist in valid_rows"
573+
assert key in row_lookup, f"Message NHS {nhs} with IMMS_ID {imms_id} does not match any row"
573574

574-
row = row_lookup[nhs]
575+
row = row_lookup[key]
575576

576577
context.nhs_number = row.NHS_NUMBER
577578
context.gp_code = get_gp_code_by_nhs_number(row.NHS_NUMBER)

0 commit comments

Comments
 (0)