def test_should_record_message_status_when_soap_error_response_returned_from_spine( self): """ Message ID: '3771F30C-A231-4D64-A46C-E7FB0D52C27C' configured in fakespine to return a soap fault """ # Arrange message, message_id = build_message( 'REPC_IN150016UK05', '9689177923', message_id='3771F30C-A231-4D64-A46C-E7FB0D52C27C') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='REPC_IN150016UK05 ', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_SYNC_ASYNC_MESSAGE_SUCCESSFULLY_RESPONDED', 'WORKFLOW': 'sync-async' })
def test_should_record_message_status_as_nackd_when_ebxml_error_response_returned_from_spine_when_sync_async_requested( self): """ Message ID: 'A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D' configured in fakespine to return a ebxml fault """ # Arrange message, message_id = build_message( 'REPC_IN150016UK05', '9689177923', message_id='A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='REPC_IN150016UK05 ', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_SYNC_ASYNC_MESSAGE_SUCCESSFULLY_RESPONDED', 'WORKFLOW': 'sync-async' })
def test_should_return_bad_request_when_client_sends_invalid_message(self): # Arrange message, message_id = build_message('COPC_IN000001UK01') # attachment with content type that is not permitted attachments = [{ 'content_type': 'application/zip', 'is_base64': False, 'description': 'Some description', 'payload': 'Some payload' }] # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01', message_id=message_id, sync_async=False) \ .with_body(message, attachments=attachments) \ .execute_post_expecting_bad_request_response() # Assert self.assertEqual( response.text, "400: Invalid request. Validation errors: {'attachments': {0: " "{'content_type': ['Must be one of: text/plain, text/html, application/pdf, " "text/xml, application/xml, text/rtf, audio/basic, audio/mpeg, image/png, " "image/gif, image/jpeg, image/tiff, video/mpeg, application/msword, " "application/octet-stream.']}}}")
def test_should_record_message_status_when_a_business_level_retry_is_required_and_succeeds( self): """ Message ID: '35586865-45B0-41A5-98F6-817CA6F1F5EF' configured in fakespine to return a SOAP Fault error, after 2 retries fakespine will return a success response. """ # Arrange message, message_id = build_message( 'COPC_IN000001UK01', '9689177923', message_id='35586865-45B0-41A5-98F6-817CA6F1F5EF') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01 ', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_success() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_ACKD', 'WORKFLOW': 'forward-reliable' })
def test_should_record_message_status_when_soap_fault_returned_from_spine( self): """ Message ID: 3771F30C-A231-4D64-A46C-E7FB0D52C27C configured in fakespine to return a SOAP Fault error. Error found here: fake_spine/fake_spine/configured_responses/soap_fault_single_error.xml """ # Arrange message, message_id = build_message( 'COPC_IN000001UK01', '9446245796', message_id='3771F30C-A231-4D64-A46C-E7FB0D52C27C') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_NACKD', 'WORKFLOW': 'forward-reliable' })
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_record_message_status_as_nackd_when_ebxml_error_response_returned_from_spine( self): """ Message ID: '7AA57E38-8B20-4AE0-9E73-B9B0C0C42BDA' configured in fakespine to return a ebxml Fault error. Error found here: fake_spine/fake_spine/configured_responses/ebxml_fault_single_error.xml """ # Arrange message, message_id = build_message( 'QUPC_IN160101UK05', '9689177923', message_id='7AA57E38-8B20-4AE0-9E73-B9B0C0C42BDA') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_NACKD', 'WORKFLOW': 'async-express' })
def test_should_return_information_from_an_ebxml_fault_returned_from_spine_in_original_post_request_when_sync_async_requested( self): """ Message ID: 'A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D' configured in fakespine to return a ebxml fault Here we use 'PRSC_IN080000UK07' which is an eRS slot polling call, it is a forward reliable message type that can be wrapped in sync-async """ # Arrange message, message_id = build_message( 'PRSC_IN080000UK07', '9689177923', message_id='A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='PRSC_IN080000UK07 ', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert TextErrorResponseAssertor(response.text) \ .assert_code_context('urn:oasis:names:tc:ebxml') \ .assert_severity('Error') \ .assert_error_type('ebxml_error')
def test_should_update_status_when_a_ebxml_fault_is_returned_from_spine_and_sync_async_is_requested( self): """ Message ID: A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D configured in fakespine to return a ebxml Fault error. Error found here: fake_spine/fake_spine/configured_responses/ebxml_fault_single_error.xml Here we use 'PRSC_IN080000UK07' which is an eRS slot polling call, it is a forward reliable message type that can be wrapped in sync-async """ # Arrange message, message_id = build_message( 'PRSC_IN080000UK07', '9446245796', message_id='3771F30C-A231-4D64-A46C-E7FB0D52C27C') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='PRSC_IN080000UK07', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_SYNC_ASYNC_MESSAGE_SUCCESSFULLY_RESPONDED', 'WORKFLOW': 'sync-async' })
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_return_information_from_soap_fault_returned_from_spine_in_original_post_request_when_sync_async_requested( self): """ Message ID: 3771F30C-A231-4D64-A46C-E7FB0D52C27C configured in fakespine to return a SOAP Fault error. Error found here: fake_spine/fake_spine/configured_responses/soap_fault_single_error.xml Here we use 'PRSC_IN080000UK07' which is an eRS slot polling call, it is a forward reliable message type that can be wrapped in sync-async """ # Arrange message, message_id = build_message( 'PRSC_IN080000UK07', '9446245796', message_id='3771F30C-A231-4D64-A46C-E7FB0D52C27C') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='PRSC_IN080000UK07', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert TextErrorResponseAssertor(response.text) \ .assert_error_code(200) \ .assert_code_context('urn:nhs:names:error:tms') \ .assert_severity('Error')
def test_should_record_message_status_when_ebxml_fault_returned_from_spine( self): """ Message ID: 'A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D' configured in fakespine to return a ebxml fault """ # Arrange message, message_id = build_message( 'COPC_IN000001UK01', '9689177923', message_id='A7D43B03-38FB-4ED7-8D04-0496DBDEDB7D') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01 ', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_MESSAGE_NACKD', 'WORKFLOW': 'forward-reliable' })
def test_should_record_message_status_when_soap_error_response_returned_from_spine_and_sync_async_requested( self): """ Message ID: AD7D39A8-1B6C-4520-8367-6B7BEBD7B842 configured in fakespine to return a SOAP Fault error. Error found here: fake_spine/fake_spine/configured_responses/soap_fault_single_error.xml """ # Arrange message, message_id = build_message( 'QUPC_IN160101UK05', '9689177923', message_id='AD7D39A8-1B6C-4520-8367-6B7BEBD7B842') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert 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': None, 'OUTBOUND_STATUS': 'OUTBOUND_SYNC_ASYNC_MESSAGE_SUCCESSFULLY_RESPONDED', 'WORKFLOW': 'sync-async' })
def test_should_return_successful_response_from_spine_in_original_post_request_body_if_sync_async_requested(self): # Arrange message, message_id = build_message('REPC_IN150016UK05', '9446245796') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='REPC_IN150016UK05', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_success() # Assert Hl7XmlResponseAssertor(response.text) \ .assert_element_exists_with_value('.//requestSuccessDetail//detail', 'GP Summary upload successful')
def test_should_return_500_response_when_inbound_service_receives_message_in_invalid_format( self): # Arrange message, message_id = build_message( 'INBOUND_UNEXPECTED_INVALID_MESSAGE', '9689177923') # Act response = InboundProxyHttpRequestBuilder() \ .with_body(message) \ .execute_post_expecting_error_response() # Assert self.assertIn('Exception during inbound message parsing', response.text)
def test_should_return_successful_response_from_spine_in_original_post_request_body_if_sync_async_requested( self): # Arrange message, message_id = build_message('QUPC_IN160101UK05', '9689177923') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=True) \ .with_body(message) \ .execute_post_expecting_success() # Assert Hl7XmlResponseAssertor(response.text) \ .assert_element_attribute('.//queryAck//queryResponseCode', 'code', 'OK') \ .assert_element_attribute('.//patient//id', 'extension', '9689177923')
def test_should_return_bad_request_when_client_sends_invalid_message(self): # Arrange message, message_id = build_message('QUPC_IN160101UK05', '9689174606') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=False) \ .with_body({'blah': '123'}) \ .execute_post_expecting_bad_request_response() # Assert self.assertEqual( response.text, "400: Invalid request. Validation errors: {'payload': ['Not a valid string.']}" )
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_record_the_correct_response_between_the_inbound_and_outbound_components_if_sync_async_requested(self): # Arrange message, message_id = build_message('REPC_IN150016UK05', '9446245796') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='REPC_IN150016UK05', message_id=message_id, sync_async=True, correlation_id='1') \ .with_body(message) \ .execute_post_expecting_success() # Assert DynamoSyncAsyncMhsTableStateAssertor(MHS_SYNC_ASYNC_TABLE_DYNAMO_WRAPPER.get_all_records_in_table()) \ .assert_single_item_exists_with_key(message_id) \ .assert_element_exists_with_value('.//requestSuccessDetail//detail', 'GP Summary upload successful')
def test_should_return_nack_when_forward_reliable_message_is_not_meant_for_the_mhs_system( self): # Arrange message, message_id = build_message('INBOUND_UNEXPECTED_MESSAGE', '9689177923', to_party_id="NOT_THE_MHS") # Act response = InboundProxyHttpRequestBuilder()\ .with_body(message)\ .execute_post_expecting_success() # Assert EbXmlResponseAssertor(response.text)\ .assert_element_attribute(".//ErrorList//Error", "errorCode", "ValueNotRecognized")\ .assert_element_attribute(".//ErrorList//Error", "severity", "Error")\ .assert_element_exists_with_value(".//ErrorList//Error//Description", "501314:Invalid To Party Type attribute")
def test_should_return_successful_response_to_client_when_a_business_level_retry_is_required_and_succeeds( self): """ Message ID: '35586865-45B0-41A5-98F6-817CA6F1F5EF' configured in fakespine to return a SOAP Fault error, after 2 retries fakespine will return a success response. """ # Arrange message, message_id = build_message( 'COPC_IN000001UK01', '9689177923', message_id='35586865-45B0-41A5-98F6-817CA6F1F5EF') # Act/Assert: Response should be 202 MhsHttpRequestBuilder() \ .with_headers(interaction_id='COPC_IN000001UK01 ', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_success()
def test_should_return_successful_response_from_spine_in_original_post_request_body( self): # Arrange message, message_id = build_message('QUPA_IN040000UK32', '9689174606') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPA_IN040000UK32', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_success() # Assert Hl7XmlResponseAssertor(response.text) \ .assert_element_exists('.//retrievalQueryResponse//QUPA_IN050000UK32//PdsSuccessfulRetrieval') \ .assert_element_attribute('.//queryAck//queryResponseCode', 'code', 'OK') \ .assert_element_attribute('.//patientRole//id', 'extension', '9689174606') \ .assert_element_attribute('.//messageRef//id', 'root', message_id)
def test_should_return_success_response_from_spine_as_json(self): # Arrange scr_json, message_id = build_message('json_16UK05', patient_nhs_number='9689174606') # Act response = ScrHttpRequestBuilder() \ .with_headers(interaction_name='SCR_GP_SUMMARY_UPLOAD', message_id=message_id, correlation_id='2') \ .with_body(scr_json) \ .execute_post_expecting_success() # Assert JsonResponseAssertor(response.text) \ .assert_key_exists('messageId') \ .assert_key_exists('creationTime') \ .assert_key_exists_with_value('messageRef', message_id) \ .assert_key_exists_with_value('messageDetail', 'GP Summary upload successful')
def test_should_record_synchronous_message_status_as_successful(self): # Arrange message, message_id = build_message('QUPA_IN040000UK32', '9689174606') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPA_IN040000UK32', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_success() # Assert 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': None, 'OUTBOUND_STATUS': 'SYNC_RESPONSE_SUCCESSFUL', 'WORKFLOW': 'sync' })
def test_should_return_a_bad_request_to_the_client_when_the_client_provides_a_bad_request( self): # Arrange scr_json, message_id = build_message( 'bad_gp_summary_upload_json', patient_nhs_number='9689174606', message_id='AD7D39A8-1B6C-4520-8367-6B7BEBD7B842') # Act response = ScrHttpRequestBuilder() \ .with_headers(interaction_name='SCR_GP_SUMMARY_UPLOAD', message_id='AD7D39A8-1B6C-4520-8367-6B7BEBD7B842', correlation_id='2') \ .with_body(scr_json) \ .execute_post_expecting_bad_request_response() # Assert self.assertEqual(response.status_code, 400) self.assertIn('Error whilst generating message', response.text)
def test_should_return_a_500_to_client_when_mhs_returns_500_to_SCR(self): # Arrange scr_json, message_id = build_message( 'json_16UK05', patient_nhs_number='9689174606', message_id='AD7D39A8-1B6C-4520-8367-6B7BEBD7B842') # Act response = ScrHttpRequestBuilder() \ .with_headers(interaction_name='SCR_GP_SUMMARY_UPLOAD', message_id='AD7D39A8-1B6C-4520-8367-6B7BEBD7B842', correlation_id='2') \ .with_body(scr_json) \ .execute_post_expecting_internal_server_error() # Assert self.assertEqual(response.status_code, 500) self.assertIn('Error whilst attempting to send the message to the MHS', response.text)
def test_should_record_the_correct_response_between_the_inbound_and_outbound_components_if_sync_async_requested( self): # Arrange message, message_id = build_message('QUPC_IN160101UK05', '9689177923') # Act MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=True, correlation_id='1') \ .with_body(message) \ .execute_post_expecting_success() # Assert DynamoSyncAsyncMhsTableStateAssertor(MHS_SYNC_ASYNC_TABLE_DYNAMO_WRAPPER.get_all_records_in_table()) \ .assert_single_item_exists_with_key(message_id) \ .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('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_information_from_ebxml_fault_returned_from_spine_in_original_post_request( self): """ Message ID: '7AA57E38-8B20-4AE0-9E73-B9B0C0C42BDA' configured in fakespine to return a ebxml Fault error. Error found here: fake_spine/fake_spine/configured_responses/ebxml_fault_single_error.xml """ # Arrange message, message_id = build_message( 'QUPC_IN160101UK05', '9689177923', message_id='7AA57E38-8B20-4AE0-9E73-B9B0C0C42BDA') # Act response = MhsHttpRequestBuilder() \ .with_headers(interaction_id='QUPC_IN160101UK05', message_id=message_id, sync_async=False) \ .with_body(message) \ .execute_post_expecting_error_response() # Assert TextErrorResponseAssertor(response.text) \ .assert_code_context('urn:oasis:names:tc:ebxml') \ .assert_severity('Error') \ .assert_error_type('ebxml_error')
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')