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)
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)
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')