Ejemplo n.º 1
0
 def test_delete(self):
     self._save_observations()
     records = [x for x in Observation.find(self.dataset)]
     self.assertNotEqual(records, [])
     Observation.delete(self.dataset)
     records = [x for x in Observation.find(self.dataset)]
     self.assertEqual(records, [])
Ejemplo n.º 2
0
    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')