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))
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))
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))
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))