Esempio n. 1
0
def create_sms_reception_element(correlator, message, sender_address,
                                 service_activation_number):
    """
    Helper for creating an ``notifySmsReception`` element.
    """
    return NOTIFICATION_NS.notifySmsReception(
        NOTIFICATION_NS.correlator(correlator),
        NOTIFICATION_NS.message(
            L.message(message),
            L.senderAddress(format_address(normalize_address(sender_address))),
            L.smsServiceActivationNumber(service_activation_number)))
Esempio n. 2
0
def create_sms_reception_element(correlator, message, sender_address,
                                 service_activation_number):
    """
    Helper for creating an ``notifySmsReception`` element.
    """
    return NOTIFICATION_NS.notifySmsReception(
        NOTIFICATION_NS.correlator(correlator),
        NOTIFICATION_NS.message(
            L.message(message),
            L.senderAddress(format_address(normalize_address(sender_address))),
            L.smsServiceActivationNumber(service_activation_number)))
Esempio n. 3
0
 def test_from_element_missing_timestamp(self):
     """
     `SmsMessage.from_element` parses a ParlayX ``SmsMessage`` complex type,
     without a timestamp, into an `SmsMessage` instance.
     """
     msg = SmsMessage.from_element(
         NOTIFICATION_NS.message(L.message('message'),
                                 L.senderAddress('tel:27117654321'),
                                 L.smsServiceActivationNumber('54321')))
     self.assertEqual(('message', '+27117654321', '54321', None),
                      (msg.message, msg.sender_address,
                       msg.service_activation_number, msg.timestamp))
Esempio n. 4
0
 def test_from_element_missing_timestamp(self):
     """
     `SmsMessage.from_element` parses a ParlayX ``SmsMessage`` complex type,
     without a timestamp, into an `SmsMessage` instance.
     """
     msg = SmsMessage.from_element(
         NOTIFICATION_NS.message(
             L.message('message'),
             L.senderAddress('tel:27117654321'),
             L.smsServiceActivationNumber('54321')))
     self.assertEqual(
         ('message', '+27117654321', '54321', None),
         (msg.message, msg.sender_address, msg.service_activation_number,
          msg.timestamp))
Esempio n. 5
0
 def test_from_element(self):
     """
     `SmsMessage.from_element` parses a ParlayX ``SmsMessage`` complex type,
     with an ISO8601 timestamp, into an `SmsMessage` instance.
     """
     timestamp = datetime(
         2013, 6, 12, 13, 15, 0, tzinfo=iso8601.iso8601.Utc())
     msg = SmsMessage.from_element(
         NOTIFICATION_NS.message(
             L.message('message'),
             L.senderAddress('tel:27117654321'),
             L.smsServiceActivationNumber('54321'),
             L.dateTime('2013-06-12T13:15:00')))
     self.assertEqual(
         ('message', '+27117654321', '54321', timestamp),
         (msg.message, msg.sender_address, msg.service_activation_number,
          msg.timestamp))
Esempio n. 6
0
 def test_from_element(self):
     """
     `SmsMessage.from_element` parses a ParlayX ``SmsMessage`` complex type,
     with an ISO8601 timestamp, into an `SmsMessage` instance.
     """
     timestamp = datetime(2013,
                          6,
                          12,
                          13,
                          15,
                          0,
                          tzinfo=iso8601.iso8601.Utc())
     msg = SmsMessage.from_element(
         NOTIFICATION_NS.message(L.message('message'),
                                 L.senderAddress('tel:27117654321'),
                                 L.smsServiceActivationNumber('54321'),
                                 L.dateTime('2013-06-12T13:15:00')))
     self.assertEqual(('message', '+27117654321', '54321', timestamp),
                      (msg.message, msg.sender_address,
                       msg.service_activation_number, msg.timestamp))