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_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_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_information_from_soap_fault_returned_from_spine_in_original_post_request_to_client(
            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
        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_error_code(200) \
            .assert_code_context('urn:nhs:names:error:tms') \
            .assert_severity('Error')
    def test_should_return_information_from_ebxml_fault_returned_by_spine_in_original_post_request_to_client(
            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
        response = MhsHttpRequestBuilder() \
            .with_headers(interaction_id='COPC_IN000001UK01 ', 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_information_from_soap_fault_from_spine_in_original_post_request_to_client_when_sync_async_requested(
            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
        TextErrorResponseAssertor(response.text) \
            .assert_error_code(200) \
            .assert_code_context('urn:nhs:names:error:tms') \
            .assert_severity('Error')
    def test_should_return_information_from_soap_fault_returned_by_spine_in_original_post_request_to_client(
            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
        response = MhsHttpRequestBuilder() \
            .with_headers(interaction_id='COPC_IN000001UK01', message_id=message_id, sync_async=False) \
            .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')