def test_can_propagate_custom_input_header(self): handler, handler_state = echo_handler() dispatcher = SOAPDispatcher(echo_service(handler, input_header=EchoInputHeader)) soap_header = ('<tns:InputVersion>42</tns:InputVersion>') soap_message = ( '<tns:echoRequest>' '<value>foobar</value>' '</tns:echoRequest>' ) request_message = self._wrap_with_soap_envelope(soap_message, header=soap_header) request = SOAPRequest(dict(SOAPACTION='echo', REQUEST_METHOD='POST'), request_message) response = dispatcher.dispatch(request) self.assert_is_successful_response(response, handler_state) assert_not_none(handler_state.input_header) assert_equals('42', handler_state.input_header.InputVersion)
def test_can_propagate_custom_input_header(self): handler, handler_state = echo_handler() dispatcher = SOAPDispatcher( echo_service(handler, input_header=EchoInputHeader)) soap_header = ('<tns:InputVersion>42</tns:InputVersion>') soap_message = ('<tns:echoRequest>' '<value>foobar</value>' '</tns:echoRequest>') request_message = self._wrap_with_soap_envelope(soap_message, header=soap_header) request = SOAPRequest(dict(SOAPACTION='echo', REQUEST_METHOD='POST'), request_message) response = dispatcher.dispatch(request) self.assert_is_successful_response(response, handler_state) assert_not_none(handler_state.input_header) assert_equals('42', handler_state.input_header.InputVersion)
def assert_fail(self, value, message=None): return assert_raises(AssertionError, lambda: assert_not_none(value, message=message))
def test_passes_if_value_is_not_none(self): assert_not_none(True) assert_not_none(False) assert_not_none('')