当前位置: 首页>>代码示例>>Python>>正文


Python DeliveryNodeFactory.create_alert方法代码示例

本文整理汇总了Python中eums.test.factories.delivery_node_factory.DeliveryNodeFactory.create_alert方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryNodeFactory.create_alert方法的具体用法?Python DeliveryNodeFactory.create_alert怎么用?Python DeliveryNodeFactory.create_alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eums.test.factories.delivery_node_factory.DeliveryNodeFactory的用法示例。


在下文中一共展示了DeliveryNodeFactory.create_alert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_should_create_alert_with_item_description

# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import create_alert [as 别名]
    def test_should_create_alert_with_item_description(self, mock_contact):
        purchase_order = PurchaseOrderFactory(order_number=5678)
        description = "some description"
        item = ItemFactory(description=description)
        purchase_order_item = PurchaseOrderItemFactory(purchase_order=purchase_order, item=item)
        consignee = ConsigneeFactory(name="Liverpool FC")

        contact_person_id = 'some_id'
        contact = {u'_id': contact_person_id,
                   u'firstName': u'Chris',
                   u'lastName': u'George',
                   u'phone': u'+256781111111'}
        mock_contact.return_value = contact

        node = DeliveryNodeFactory(item=purchase_order_item, consignee=consignee, contact_person_id=contact_person_id)

        node.create_alert(Alert.ISSUE_TYPES.not_received)

        alerts = Alert.objects.filter(consignee_name="Liverpool FC", order_number=5678)
        self.assertEqual(alerts.count(), 1)
        alert = alerts.first()
        self.assertEqual(alert.order_type, PurchaseOrderItem.PURCHASE_ORDER)
        self.assertEqual(alert.order_number, 5678)
        self.assertEqual(alert.consignee_name, "Liverpool FC")
        self.assertEqual(alert.contact['contact_name'], "Chris George")
        self.assertEqual(alert.issue, Alert.ISSUE_TYPES.not_received)
        self.assertFalse(alert.is_resolved)
        self.assertIsNone(alert.remarks)
        self.assertEqual(alert.runnable, node)
        self.assertEqual(alert.item_description, description)
开发者ID:v55448330,项目名称:eums,代码行数:32,代码来源:test_delivery_node.py


注:本文中的eums.test.factories.delivery_node_factory.DeliveryNodeFactory.create_alert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。