Exemplo n.º 1
0
 def test_from_element(self):
     """
     `ServiceExceptionDetail.from_element` returns
     a `ServiceExceptionDetail` instance by parsing
     a ``ServiceExceptionDetail`` detail element.
     """
     elem = PARLAYX_COMMON_NS.ServiceExceptionDetail(
         L.messageId('a'), L.text('b'), L.variables('c'), L.variables('d'))
     detail = ServiceExceptionDetail.from_element(elem)
     self.assertEqual(('a', 'b', ['c', 'd']),
                      (detail.message_id, detail.text, detail.variables))
Exemplo n.º 2
0
 def test_send_sms_policy_fault(self):
     """
     `ParlayXClient.send_sms` expects `PolicyExceptionDetail` fault details
     in SOAP requests that fail for remote policy-related reasons.
     """
     detail = PARLAYX_COMMON_NS.PolicyExceptionDetail(
         L.messageId('a'), L.text('b'), L.variables('c'), L.variables('d'))
     client = self._make_client(
         MockResponse.build(
             http.INTERNAL_SERVER_ERROR,
             soap_fault('soapenv:Server', 'Whoops', detail=detail)))
     f = self.failureResultOf(
         client.send_sms('+27117654321', 'content', 'message_id'),
         PolicyException)
     detail = f.value.parsed_detail
     self.assertEqual(('a', 'b', ['c', 'd']),
                      (detail.message_id, detail.text, detail.variables))
Exemplo n.º 3
0
 def test_stop_sms_notification_service_fault(self):
     """
     `ParlayXClient.stop_sms_notification` expects `ServiceExceptionDetail`
     fault details in SOAP requests that fail for remote service-related
     reasons.
     """
     detail = PARLAYX_COMMON_NS.ServiceExceptionDetail(
         L.messageId('a'), L.text('b'), L.variables('c'), L.variables('d'))
     client = self._make_client(
         MockResponse.build(
             http.INTERNAL_SERVER_ERROR,
             soap_fault('soapenv:Server', 'Whoops', detail=detail)))
     f = self.failureResultOf(client.stop_sms_notification(),
                              ServiceException)
     detail = f.value.parsed_detail
     self.assertEqual(('a', 'b', ['c', 'd']),
                      (detail.message_id, detail.text, detail.variables))