def test_should_record_asynchronous_express_message_status_as_successful( self): # Arrange message, message_id = build_message('QUPC_IN160101UK05', '9689177923') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=False, correlation_id='1') \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assertor_for_hl7_xml_message() \ .assert_element_attribute('.//queryAck//queryResponseCode', 'code', 'OK') AssertWithRetries(retry_count=10) \ .assert_condition_met(lambda: DynamoMhsTableStateAssertor.wait_for_inbound_response_processed(message_id)) DynamoMhsTableStateAssertor(MHS_STATE_TABLE_DYNAMO_WRAPPER.get_all_records_in_table()) \ .assert_single_item_exists_with_key(message_id) \ .assert_item_contains_values({ 'INBOUND_STATUS': 'INBOUND_RESPONSE_SUCCESSFULLY_PROCESSED', 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_ACKD', 'WORKFLOW': 'async-express' })
def test_should_record_forward_reliable_message_status_as_successful(self): # Arrange # The to_party_id, and to_asid are fixed values that the forward reliable responder in opentest will respond to. # If failures are seen here, it is probably an issue with opentest SDS not being correctly configured for your # account message, message_id = build_message('COPC_IN000001UK01', to_party_id='X26-9199246', to_asid='918999199246') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01', message_id=message_id, sync_async=False, correlation_id='1', ods_code='X26') \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assertor_for_hl7_xml_message() \ .assert_element_attribute('.//acknowledgement//messageRef//id', 'root', message_id) AssertWithRetries(retry_count=10) \ .assert_condition_met(lambda: DynamoMhsTableStateAssertor.wait_for_inbound_response_processed(message_id)) DynamoMhsTableStateAssertor(MHS_STATE_TABLE_DYNAMO_WRAPPER.get_all_records_in_table()) \ .assert_single_item_exists_with_key(message_id) \ .assert_item_contains_values({ 'INBOUND_STATUS': 'INBOUND_RESPONSE_SUCCESSFULLY_PROCESSED', 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_ACKD', 'WORKFLOW': 'forward-reliable' })
def test_should_place_unsolicited_valid_message_onto_queue_for_client_to_receive( self): # Arrange message, message_id = build_message('INBOUND_UNEXPECTED_MESSAGE', '9689177923', to_party_id="test-party-key") # Act InboundProxyHttpRequestBuilder() \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assert_property('message-id', message_id)\ .assertor_for_hl7_xml_message()\ .assert_element_attribute(".//ControlActEvent//code", "displayName", "GP2GP Large Message Attachment Information")
def test_should_return_successful_response_from_spine_to_message_queue(self): # Arrange message, message_id = build_message('REPC_IN150016UK05', '9446245796') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='REPC_IN150016UK05', message_id=message_id, sync_async=False, correlation_id='1') \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assert_property('message-id', message_id) \ .assert_property('correlation-id', '1') \ .assert_json_content_type() \ .assertor_for_hl7_xml_message() \ .assert_element_exists_with_value('.//requestSuccessDetail//detail', 'GP Summary upload successful')
def test_should_return_successful_response_from_spine_to_message_queue( self): # Arrange message, message_id = build_message('QUPC_IN160101UK05', '9689177923') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=False, correlation_id='1') \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assert_property('message-id', message_id) \ .assert_property('correlation-id', '1') \ .assert_json_content_type() \ .assertor_for_hl7_xml_message() \ .assert_element_attribute('.//queryAck//queryResponseCode', 'code', 'OK') \ .assert_element_attribute('.//patient//id', 'extension', '9689177923')
def test_should_return_successful_response_from_spine_to_message_queue( self): # Arrange message, message_id = build_message('COPC_IN000001UK01', to_party_id='X26-9199246', to_asid='918999199246') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01', message_id=message_id, sync_async=False, correlation_id='1', ods_code='X26') \ .with_body(message) \ .execute_post_expecting_success() # Assert AMQMessageAssertor(MHS_INBOUND_QUEUE.get_next_message_on_queue()) \ .assert_property('message-id', message_id) \ .assert_property('correlation-id', '1') \ .assert_json_content_type() \ .assertor_for_hl7_xml_message() \ .assert_element_attribute('.//acknowledgement//messageRef//id', 'root', message_id)