Ejemplo n.º 1
0
    def test_process_notifySmsReception(self):
        """
        `SmsNotificationService.process_notifySmsReception` invokes the
        message delivery callback with the correlator (message identifier) and
        a `SmsMessage` instance containing the details of the delivered
        message.
        """
        def callback(*a):
            self.callbacks.append(a)
        self.callbacks = []
        service = SmsNotificationService(callback, None)
        self.successResultOf(service.process(None,
            SOAP_ENV.Body(
                create_sms_reception_element(
                    '1234', 'message', '+27117654321', '54321')),
            SOAP_ENV.Header(
                PARLAYX_COMMON_NS.NotifySOAPHeader(
                    PARLAYX_COMMON_NS.linkid('linkid')))))

        self.assertEqual(1, len(self.callbacks))
        correlator, linkid, msg = self.callbacks[0]
        self.assertEqual(
            ('1234', 'linkid', 'message', '+27117654321', '54321', None),
            (correlator, linkid, msg.message, msg.sender_address,
             msg.service_activation_number, msg.timestamp))
Ejemplo n.º 2
0
    def test_process_notifySmsReception(self):
        """
        `SmsNotificationService.process_notifySmsReception` invokes the
        message delivery callback with the correlator (message identifier) and
        a `SmsMessage` instance containing the details of the delivered
        message.
        """
        def callback(*a):
            self.callbacks.append(a)

        self.callbacks = []
        service = SmsNotificationService(callback, None)
        self.successResultOf(
            service.process(
                None,
                SOAP_ENV.Body(
                    create_sms_reception_element('1234', 'message',
                                                 '+27117654321', '54321')),
                SOAP_ENV.Header(
                    PARLAYX_COMMON_NS.NotifySOAPHeader(
                        PARLAYX_COMMON_NS.linkid('linkid')))))

        self.assertEqual(1, len(self.callbacks))
        correlator, linkid, msg = self.callbacks[0]
        self.assertEqual(
            ('1234', 'linkid', 'message', '+27117654321', '54321', None),
            (correlator, linkid, msg.message, msg.sender_address,
             msg.service_activation_number, msg.timestamp))
Ejemplo n.º 3
0
 def test_receive_sms(self):
     """
     When a text message is submitted to the Vumi ParlayX
     ``notifySmsReception`` SOAP endpoint, a message is
     published containing the message identifier, message content, from
     address and to address that accurately match what was submitted.
     """
     yield self.transport.startWorker()
     body = create_sms_reception_element('1234', 'message', '+27117654321',
                                         '54321')
     yield perform_soap_request(self.uri, '', body)
     [msg] = self.tx_helper.get_dispatched_inbound()
     self.assertEqual(('1234', 'message', '+27117654321', '54321'),
                      (msg['message_id'], msg['content'], msg['from_addr'],
                       msg['to_addr']))
Ejemplo n.º 4
0
 def test_receive_sms(self):
     """
     When a text message is submitted to the Vumi ParlayX
     ``notifySmsReception`` SOAP endpoint, a message is
     published containing the message identifier, message content, from
     address and to address that accurately match what was submitted.
     """
     yield self.transport.startWorker()
     body = create_sms_reception_element(
         '1234', 'message', '+27117654321', '54321')
     yield perform_soap_request(self.uri, '', body)
     [msg] = self.tx_helper.get_dispatched_inbound()
     self.assertEqual(
         ('1234', 'message', '+27117654321', '54321'),
         (msg['message_id'], msg['content'], msg['from_addr'],
          msg['to_addr']))