本文整理汇总了Python中eums.test.factories.delivery_node_factory.DeliveryNodeFactory.save方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryNodeFactory.save方法的具体用法?Python DeliveryNodeFactory.save怎么用?Python DeliveryNodeFactory.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.test.factories.delivery_node_factory.DeliveryNodeFactory
的用法示例。
在下文中一共展示了DeliveryNodeFactory.save方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_ignore_updates_to_quantity_on_non_root_node
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_ignore_updates_to_quantity_on_non_root_node(self):
node_one = DeliveryNodeFactory()
node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 7}])
node.quantity = 50
node.save()
self.assertEqual(node.quantity_in(), 7)
示例2: test_update_should_leave_parents_intact_if_parents_are_not_specified
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_update_should_leave_parents_intact_if_parents_are_not_specified(self):
node_one = DeliveryNodeFactory()
node_two = DeliveryNodeFactory()
node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 8}, {'id': node_two.id, 'quantity': 10}])
node.location = 'Changed'
node.save()
self.assertEqual(node.quantity_in(), 18)
self.assertEqual(node.location, 'Changed')
示例3: test_should_add_changed_node_to_sync_data
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_add_changed_node_to_sync_data(self, *_):
node = DeliveryNodeFactory(location='Kampala')
SyncInfo.objects.create(status=SyncInfo.STATUS.SUCCESSFUL)
list_nodes_to_update()
node.location = 'Changed location'
node.save()
nodes_to_sync = list_nodes_to_update()
self.assertIn(node, nodes_to_sync)
示例4: test_should_not_include_match_clauses_with_empty_id_lists
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_not_include_match_clauses_with_empty_id_lists(self, mock_scan):
node = DeliveryNodeFactory(location='Kampala')
SyncInfo.objects.create(status=SyncInfo.STATUS.SUCCESSFUL)
list_nodes_to_update()
node.location = 'Changed location'
node.save()
nodes_to_sync = list_nodes_to_update()
self.assertFalse(mock_scan.called)
self.assertIn(node, nodes_to_sync)
示例5: test_should_ignore_quantity_on_update_if_parents_are_specified
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_ignore_quantity_on_update_if_parents_are_specified(self):
node_one = DeliveryNodeFactory()
node = DeliveryNodeFactory(quantity=0)
node.parents = [{'id': node_one.id, 'quantity': 7}]
node.quantity = 50
node.save()
self.assertEqual(node.quantity_in(), 7)
node.parents = []
node.save()
self.assertEqual(node.quantity_in(), 0)
示例6: test_update_should_override_parents_when_parents_list_is_passed
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_update_should_override_parents_when_parents_list_is_passed(self):
node_one = DeliveryNodeFactory()
node_two = DeliveryNodeFactory()
node = DeliveryNodeFactory(parents=[{'id': node_one.id, 'quantity': 8}, {'id': node_two.id, 'quantity': 10}])
self.assertEqual(node.quantity_in(), 18)
node.parents = [{'id': node_one.id, 'quantity': 7}]
node.save()
self.assertEqual(node.quantity_in(), 7)
node.parents = []
node.save()
self.assertEqual(node.quantity_in(), 0)
示例7: test_should_delete_tracked_node_on_update_with_zero_quantity
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_delete_tracked_node_on_update_with_zero_quantity(self):
node = DeliveryNodeFactory(quantity=10, track=True)
self.assertEqual(DeliveryNode.objects.count(), 1)
node.quantity = 0
returned_node = node.save()
self.assertEqual(DeliveryNode.objects.count(), 0)
self.assertTrue(isinstance(returned_node, DeliveryNode))
示例8: test_should_know_if_it_is_fully_delivered_or_not_using_only_tracked_nodes
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [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())
示例9: test_should_take_multiple_losses_into_account_when_calculating_balance
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_should_take_multiple_losses_into_account_when_calculating_balance(self):
node = DeliveryNodeFactory(acknowledged=50)
DeliveryNodeLossFactory(quantity=10, delivery_node=node)
DeliveryNodeLossFactory(quantity=25, delivery_node=node)
node.save()
self.assertEqual(node.balance, 15)
示例10: test_update_quantity_to__zero_on_root_node
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_update_quantity_to__zero_on_root_node(self):
node = DeliveryNodeFactory(quantity=100)
node.quantity = 0
node.save()
self.assertEqual(node.quantity_in(), 0)
示例11: test_update_quantity_on_root_node_should_update_quantity
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import save [as 别名]
def test_update_quantity_on_root_node_should_update_quantity(self):
node = DeliveryNodeFactory(quantity=100)
node.quantity = 50
node.save()
self.assertEqual(node.quantity_in(), 50)