Skip to content

Commit 44629d8

Browse files
committed
lint
1 parent c0df4a6 commit 44629d8

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

e2e_batch/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def create_row(unique_id, dose_amount, action_flag: ActionFlag, header, inject_c
7979
"SITE_CODE_TYPE_URI": "https://fhir.nhs.uk/Id/ods-organization-code",
8080
"UNIQUE_ID": unique_id,
8181
"UNIQUE_ID_URI": "https://www.ravs.england.nhs.uk/",
82-
"ACTION_FLAG": action_flag,
82+
"ACTION_FLAG": action_flag if action_flag != "NEW" else "CREATE", # TODO check if this is needed
8383
"PERFORMING_PROFESSIONAL_FORENAME": "PHYLIS",
8484
"PERFORMING_PROFESSIONAL_SURNAME": name,
8585
"RECORDED_DATE": datetime.now(timezone.utc).strftime("%Y%m%d"),

e2e_batch/test_e2e_batch.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def test_create_success(self):
6060

6161
send_files(tests)
6262

63-
poll_for_responses(tests, max_timeout)
63+
if not poll_for_responses(tests, max_timeout):
64+
logger.error("Timeout waiting for responses")
6465

6566
validate_responses(tests)
6667

@@ -76,19 +77,22 @@ def send_files(tests: list[TestData]):
7677
logger.info(f"Files uploaded. Time: {time.time() - start_time:.1f} seconds")
7778

7879

79-
def poll_for_responses(tests: list[TestData], max_timeout=1200):
80+
def poll_for_responses(tests: list[TestData], max_timeout=1200) -> bool:
8081
logger.info("Waiting while processing...")
8182
start_time = time.time()
8283
# while there are still pending files, poll for acks and forwarded files
8384
pending = True
84-
while pending and (time.time() - start_time) < max_timeout:
85+
while pending:
8586
pending = False
8687
for test in tests:
8788
pending = test.poll_destination(pending)
8889
if pending:
8990
print(".", end="")
9091
time.sleep(5)
92+
if (time.time() - start_time) > max_timeout:
93+
return False
9194
logger.info(f"Files processed. Time: {time.time() - start_time:.1f} seconds")
95+
return True
9296

9397

9498
def validate_responses(tests: list[TestData]):
@@ -117,7 +121,9 @@ def validate_responses(tests: list[TestData]):
117121
test.getOperations())
118122
else:
119123
logger.error(f"BUS ACK file not found for test: {test.name}")
124+
120125
if count == expected_count:
121-
logger.info(f"Responses validated. Time: {time.time() - start_time:.1f} seconds")
126+
logger.info("All responses subject to validation.")
122127
else:
123-
logger.error(f"Only {count} of {expected_count} expected responses found. Time: {time.time() - start_time:.1f} seconds")
128+
logger.error(f"{count} of {expected_count} responses subject to validation.")
129+
logger.info(f"Time: {time.time() - start_time:.1f} seconds")

0 commit comments

Comments
 (0)