本文整理汇总了Python中eums.test.factories.delivery_factory.DeliveryFactory.track方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryFactory.track方法的具体用法?Python DeliveryFactory.track怎么用?Python DeliveryFactory.track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.test.factories.delivery_factory.DeliveryFactory
的用法示例。
在下文中一共展示了DeliveryFactory.track方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_mirror_delivery_tracked_status_on_all_nodes_when_tracked_status_changes_on_delivery
# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import track [as 别名]
def test_should_mirror_delivery_tracked_status_on_all_nodes_when_tracked_status_changes_on_delivery(self):
Delivery.objects.all().delete()
delivery = DeliveryFactory(track=False)
root_node = DeliveryNodeFactory(distribution_plan=delivery)
child_node = DeliveryNodeFactory(distribution_plan=delivery, parents=[(root_node, 5)])
self.assertFalse(root_node.track)
self.assertFalse(child_node.track)
delivery.track = True
delivery.save()
self.assertTrue(DeliveryNode.objects.get(pk=root_node.id).track)
self.assertTrue(DeliveryNode.objects.get(pk=child_node.id).track)
delivery.track = False
delivery.save()
self.assertFalse(DeliveryNode.objects.get(pk=root_node.id).track)
self.assertFalse(DeliveryNode.objects.get(pk=child_node.id).track)
示例2: test_balance_should_decrease_when_tracked_nodes_exist
# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import track [as 别名]
def test_balance_should_decrease_when_tracked_nodes_exist(self):
purchase_order_item = PurchaseOrderItemFactory(purchase_order=(PurchaseOrderFactory()), quantity=500)
delivery = DeliveryFactory()
node_one = NodeFactory(item=purchase_order_item, quantity=200, distribution_plan=delivery)
self.assertEquals(purchase_order_item.available_balance(), 500)
delivery.track = True
delivery.save()
self.assertEquals(purchase_order_item.available_balance(), 300)
NodeFactory(item=purchase_order_item, quantity=120, distribution_plan=delivery)
self.assertEquals(purchase_order_item.available_balance(), 180)
示例3: test_should_decrease_balance_when_saving_tracked_or_not_tracked_nodes
# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import track [as 别名]
def test_should_decrease_balance_when_saving_tracked_or_not_tracked_nodes(self):
purchase_order_item = PurchaseOrderItemFactory(quantity=500)
delivery = DeliveryFactory()
DeliveryNodeFactory(item=purchase_order_item, quantity=200, distribution_plan=delivery)
self.assertEquals(purchase_order_item.available_balance(), 300)
self.assertEquals(purchase_order_item.quantity_shipped(), 200)
delivery.track = True
delivery.save()
self.assertEquals(purchase_order_item.available_balance(), 300)
self.assertEquals(purchase_order_item.quantity_shipped(), 200)
tracked_delivery = DeliveryFactory(track=True)
DeliveryNodeFactory(item=purchase_order_item, quantity=120, distribution_plan=tracked_delivery)
self.assertEquals(purchase_order_item.available_balance(), 180)
self.assertEquals(purchase_order_item.quantity_shipped(), 320)
示例4: test_should_know_if_it_is_fully_delivered_or_not_using_only_tracked_nodes
# 需要导入模块: from eums.test.factories.delivery_factory import DeliveryFactory [as 别名]
# 或者: from eums.test.factories.delivery_factory.DeliveryFactory import track [as 别名]
def test_should_know_if_it_is_fully_delivered_or_not_using_only_tracked_nodes(self):
purchase_order = PurchaseOrderFactory()
item_one = PurchaseOrderItemFactory(purchase_order=purchase_order, quantity=100)
item_two = PurchaseOrderItemFactory(purchase_order=purchase_order, quantity=100)
self.assertFalse(purchase_order.is_fully_delivered())
delivery = DeliveryFactory()
node_one = NodeFactory(item=item_one, quantity=100, distribution_plan=delivery)
self.assertFalse(purchase_order.is_fully_delivered())
node_two = NodeFactory(item=item_two, quantity=100, distribution_plan=delivery)
self.assertFalse(purchase_order.is_fully_delivered())
delivery.track = True
delivery.save()
node_two.quantity = 50
node_two.save()
self.assertFalse(purchase_order.is_fully_delivered())
node_two.quantity = 100
node_two.save()
self.assertTrue(purchase_order.is_fully_delivered())