Exemplo n.º 1
0
    def test_can_use_soap_error_from_handler(self):
        soap_error = SOAPError('code', 'internal data error', 'actor')
        faulty_handler = lambda request, input_: SOAPResponse(soap_error)
        dispatcher = SOAPDispatcher(echo_service(handler=faulty_handler))
        soap_message = ('<ns1:echoRequest xmlns:ns1="http://soap.example/echo/types">'
            '<value>foobar</value>'
        '</ns1:echoRequest>')
        request_message = self._wrap_with_soap_envelope(soap_message)
        request = SOAPRequest(dict(REQUEST_METHOD='POST'), request_message)

        response = dispatcher.dispatch(request)
        assert_equals('text/xml', response.http_headers['Content-Type'])
        assert_equals(500, response.http_status_code)
        self.assert_is_soap_fault(response,
            fault_code='code',
            partial_fault_string=u'internal data error'
        )
Exemplo n.º 2
0
 def faulty_handler(request, input_):
     return SOAPResponse(soap_error)
Exemplo n.º 3
0
 def test_constructor(self):
     response = SOAPResponse('', http_status_code=500)
     self.assertEqual(500, response.http_status_code)