本文整理汇总了Python中eums.test.factories.delivery_node_factory.DeliveryNodeFactory.delete方法的典型用法代码示例。如果您正苦于以下问题:Python DeliveryNodeFactory.delete方法的具体用法?Python DeliveryNodeFactory.delete怎么用?Python DeliveryNodeFactory.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eums.test.factories.delivery_node_factory.DeliveryNodeFactory
的用法示例。
在下文中一共展示了DeliveryNodeFactory.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_should_delete_node_from_elasticsearch_when_deleted
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import delete [as 别名]
def test_should_delete_node_from_elasticsearch_when_deleted(self):
node = DeliveryNodeFactory()
SyncInfo.objects.create(status=SyncInfo.STATUS.SUCCESSFUL)
node.delete()
nodes_to_delete = list_nodes_to_delete()
self.assertIn(node.id, nodes_to_delete)
示例2: test_should_update_balance_when_node_quantities_change
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import delete [as 别名]
def test_should_update_balance_when_node_quantities_change(self):
node = DeliveryNodeFactory(quantity=100, acknowledged=100)
child = DeliveryNodeFactory(parents=[(node, 50)])
self.assertEqual(child.balance, 50)
self.assertEqual(DeliveryNode.objects.get(id=node.id).balance, 50)
child_two = DeliveryNodeFactory(parents=[(node, 40)])
self.assertEqual(child_two.balance, 40)
self.assertEqual(DeliveryNode.objects.get(id=node.id).balance, 10)
child_two.delete()
self.assertEqual(DeliveryNode.objects.get(id=node.id).balance, 50)
示例3: test_should_push_deleted_nodes_to_elasticsearch
# 需要导入模块: from eums.test.factories.delivery_node_factory import DeliveryNodeFactory [as 别名]
# 或者: from eums.test.factories.delivery_node_factory.DeliveryNodeFactory import delete [as 别名]
def test_should_push_deleted_nodes_to_elasticsearch(self, mock_serialise_nodes,
mock_post, mock_get, mock_converter, *_):
mock_get.return_value = FakeResponse({}, status_code=HTTP_200_OK)
node = DeliveryNodeFactory()
run()
node.delete()
api_data = '{}'
stub_nodes_to_update = {'id': 10}
mock_serialise_nodes.return_value = stub_nodes_to_update
mock_converter.return_value = api_data
mock_post.return_value = FakeResponse({}, status_code=HTTP_200_OK)
run()
mock_converter.assert_called_with(stub_nodes_to_update, [node.id])
mock_post.assert_called_with(settings.ELASTIC_SEARCH.BULK, data=api_data)
self.assertListEqual(DeleteRecords.objects.first().nodes_to_delete, [])