def testProcessingFault(self): """Tests whether we can handle a processing fault.""" try: buf = SoapBuffer() buf.InjectXml(self.__class__.XML_RESPONSE_FAULT2) raise ApiError(buf.GetFaultAsDict()) except ApiError, e: self.assertEqual(e.message, self.__class__.TRIGGER_MSG3)
def testErrorsFault(self): """Tests whether we can handle a fault with errors elements.""" try: buf = SoapBuffer() buf.InjectXml(self.__class__.XML_RESPONSE_FAULT3) raise ApiError(buf.GetFaultAsDict()) except ApiError, e: self.assertEqual(e.message, self.__class__.TRIGGER_MSG4) self.assertEqual(int(e.code), self.__class__.TRIGGER_CODE4)
def testStacktraceElement(self): """Tests whether we can handle a fault's stacktrace element.""" try: buf = SoapBuffer() buf.InjectXml(self.__class__.XML_RESPONSE_FAULT1) raise ApiError(buf.GetFaultAsDict()) except ApiError, e: self.assertEqual(e.message, self.__class__.TRIGGER_MSG2) self.assertEqual(int(e.code), self.__class__.TRIGGER_CODE2)