示例#1
0
文件: utils.py 项目: AndrewCvekl/vumi
def create_sms_delivery_receipt(correlator, address, delivery_status):
    """
    Helper for creating an ``notifySmsDeliveryReceipt`` element.
    """
    return NOTIFICATION_NS.notifySmsDeliveryReceipt(
        NOTIFICATION_NS.correlator(correlator),
        NOTIFICATION_NS.deliveryStatus(
            L.address(format_address(normalize_address(address))),
            L.deliveryStatus(delivery_status.name)))
示例#2
0
文件: utils.py 项目: musabaloyi/vumi
def create_sms_delivery_receipt(correlator, address, delivery_status):
    """
    Helper for creating an ``notifySmsDeliveryReceipt`` element.
    """
    return NOTIFICATION_NS.notifySmsDeliveryReceipt(
        NOTIFICATION_NS.correlator(correlator),
        NOTIFICATION_NS.deliveryStatus(
            L.address(format_address(normalize_address(address))),
            L.deliveryStatus(delivery_status.name)))
示例#3
0
 def test_from_element_unknown_status(self):
     """
     `DeliveryInformation.from_element` raises ``ValueError`` if an unknown
     ``DeliveryStatus`` enumeration value is specified.
     """
     e = self.assertRaises(
         ValueError, DeliveryInformation.from_element,
         NOTIFICATION_NS.deliveryStatus(L.address('tel:27117654321'),
                                        L.deliveryStatus('WhatIsThis')))
     self.assertEqual(
         "No such delivery status enumeration value: 'WhatIsThis'", str(e))
示例#4
0
 def test_from_element_unknown_status(self):
     """
     `DeliveryInformation.from_element` raises ``ValueError`` if an unknown
     ``DeliveryStatus`` enumeration value is specified.
     """
     e = self.assertRaises(ValueError,
         DeliveryInformation.from_element,
         NOTIFICATION_NS.deliveryStatus(
             L.address('tel:27117654321'),
             L.deliveryStatus('WhatIsThis')))
     self.assertEqual(
         "No such delivery status enumeration value: 'WhatIsThis'", str(e))
示例#5
0
 def test_from_element(self):
     """
     `DeliveryInformation.from_element` parses a ParlayX
     ``DeliveryInformation`` complex type into a `DeliveryInformation`
     instance. Known ``DeliveryStatus`` enumeration values are parsed into
     `DeliveryStatus` attributes.
     """
     info = DeliveryInformation.from_element(
         NOTIFICATION_NS.deliveryStatus(
             L.address('tel:27117654321'),
             L.deliveryStatus('DeliveredToNetwork')))
     self.assertEqual(('+27117654321', DeliveryStatus.DeliveredToNetwork),
                      (info.address, info.delivery_status))
示例#6
0
 def test_from_element(self):
     """
     `DeliveryInformation.from_element` parses a ParlayX
     ``DeliveryInformation`` complex type into a `DeliveryInformation`
     instance. Known ``DeliveryStatus`` enumeration values are parsed into
     `DeliveryStatus` attributes.
     """
     info = DeliveryInformation.from_element(
         NOTIFICATION_NS.deliveryStatus(
             L.address('tel:27117654321'),
             L.deliveryStatus('DeliveredToNetwork')))
     self.assertEqual(
         ('+27117654321', DeliveryStatus.DeliveredToNetwork),
         (info.address, info.delivery_status))