本文整理汇总了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)