def test_delete(self): for dataset_name in self.TEST_DATASETS: record = Dataset.save(self.test_dataset_ids[dataset_name]) records = [x for x in \ Dataset.find(self.test_dataset_ids[dataset_name])] self.assertNotEqual(records, []) Dataset.delete(self.test_dataset_ids[dataset_name]) records = [x for x in Dataset.find(self.test_dataset_ids[dataset_name])] self.assertEqual(records, [])
def DELETE(self, dataset_id): """ Delete observations (i.e. the dataset) with hash *dataset_id* from mongo """ dataset = Dataset.find_one(dataset_id) result = None if dataset: Dataset.delete(dataset_id) Observation.delete(dataset) result = {SUCCESS: 'deleted dataset: %s' % dataset_id} return dump_or_error(result, 'id not found')