def test_ingest_hl7v2_message(test_dataset, test_hl7v2_store, capsys): hl7v2_messages.ingest_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_file) @backoff.on_exception(backoff.expo, AssertionError, max_time=60) def run_eventually_consistent_test(): hl7v2_messages_list = hl7v2_messages.list_hl7v2_messages( project_id, cloud_region, dataset_id, hl7v2_store_id) assert len(hl7v2_messages_list) > 0 hl7v2_message_name = hl7v2_messages_list[0].get("name") elms = hl7v2_message_name.split("/", 9) assert len(elms) >= 10 hl7v2_message_id = elms[9] return hl7v2_message_id hl7v2_message_id = run_eventually_consistent_test() hl7v2_messages.get_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) hl7v2_messages.delete_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) out, _ = capsys.readouterr() # Check that ingest/get/list/delete worked assert "Ingested HL7v2 message" in out assert "Name" in out assert "Deleted HL7v2 message" in out
def test_ingest_hl7v2_message(test_dataset, test_hl7v2_store, capsys): hl7v2_messages.ingest_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_file) hl7v2_messages_list = hl7v2_messages.list_hl7v2_messages( service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id) hl7v2_messages_list_to_str = str(hl7v2_messages_list).split('/', 9)[9] hl7v2_message_id = re.sub('\']', '', hl7v2_messages_list_to_str) hl7v2_messages.get_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) hl7v2_messages.delete_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) out, _ = capsys.readouterr() # Check that ingest/get/list/delete worked assert 'Ingested HL7v2 message' in out assert 'Name' in out assert 'Deleted HL7v2 message' in out
def test_ingest_hl7v2_message(test_dataset, test_hl7v2_store, capsys): hl7v2_messages.ingest_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_file) hl7v2_message_id = "" @eventually_consistent.call def _(): hl7v2_messages_list = hl7v2_messages.list_hl7v2_messages( service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id) assert len(hl7v2_messages_list) > 0 hl7v2_message_name = hl7v2_messages_list[0].get('name') nonlocal hl7v2_message_id hl7v2_message_id = hl7v2_message_name.split('/', 9)[9] hl7v2_messages.get_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) hl7v2_messages.delete_hl7v2_message(service_account_json, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) out, _ = capsys.readouterr() # Check that ingest/get/list/delete worked assert 'Ingested HL7v2 message' in out assert 'Name' in out assert 'Deleted HL7v2 message' in out
def test_ingest_hl7v2_message(test_dataset, test_hl7v2_store, capsys): hl7v2_messages.ingest_hl7v2_message( service_account_json, api_key, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_file) hl7v2_messages_list = hl7v2_messages.list_hl7v2_messages( service_account_json, api_key, project_id, cloud_region, dataset_id, hl7v2_store_id) hl7v2_messages_list_to_str = str(hl7v2_messages_list).split('/', 9)[9] hl7v2_message_id = re.sub('\']', '', hl7v2_messages_list_to_str) hl7v2_messages.get_hl7v2_message( service_account_json, api_key, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) hl7v2_messages.delete_hl7v2_message( service_account_json, api_key, project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) out, _ = capsys.readouterr() # Check that ingest/get/list/delete worked assert 'Ingested HL7v2 message' in out assert 'Name' in out assert 'Deleted HL7v2 message' in out
def test_ingest_hl7v2_message(test_dataset, test_hl7v2_store, capsys): hl7v2_messages.ingest_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_file) hl7v2_messages_list = hl7v2_messages.list_hl7v2_messages( project_id, cloud_region, dataset_id, hl7v2_store_id) hl7v2_message_name = hl7v2_messages_list[0].get("name") hl7v2_message_id = hl7v2_message_name.split("/", 9)[9] hl7v2_messages.get_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) hl7v2_messages.delete_hl7v2_message(project_id, cloud_region, dataset_id, hl7v2_store_id, hl7v2_message_id) out, _ = capsys.readouterr() # Check that ingest/get/list/delete worked assert "Ingested HL7v2 message" in out assert "Name" in out assert "Deleted HL7v2 message" in out