def test_delete_job(self): with self.assertRaises(dataset_eval.JobNotFoundException): dataset_eval.delete_job(self.test_uuid) job_id = dataset_eval._create_job(self.conn, self.test_dataset_id, True, dataset_eval.EVAL_LOCAL) snapshots = dataset.get_snapshots_for_dataset(self.test_dataset_id) self.assertEqual(len(snapshots), 1) self.assertIsNotNone(dataset_eval.get_job(job_id)) dataset_eval.delete_job(job_id) snapshots = dataset.get_snapshots_for_dataset(self.test_dataset_id) self.assertEqual(len(snapshots), 0) self.assertIsNone(dataset_eval.get_job(job_id))
def test_delete_shapshot(self): id = dataset.create_from_dict(self.test_data, author_id=self.test_user_id) snap_id = dataset.create_snapshot(id) snapshots = dataset.get_snapshots_for_dataset(id) self.assertEqual(len(snapshots), 1) with db.engine.connect() as connection: dataset._delete_snapshots_for_dataset(connection, id) snapshots = dataset.get_snapshots_for_dataset(id) self.assertEqual(len(snapshots), 0) with self.assertRaises(db.exceptions.NoDataFoundException): dataset.get_snapshot(snap_id)
def test_create_snapshot(self): id = dataset.create_from_dict(self.test_data, author_id=self.test_user_id) snapshots = dataset.get_snapshots_for_dataset(id) self.assertEqual(len(snapshots), 0) snap_id = dataset.create_snapshot(id) snapshots = dataset.get_snapshots_for_dataset(id) self.assertEqual(len(snapshots), 1) self.assertEqual(snapshots[0]["id"], snap_id) snap = dataset.get_snapshot(snap_id) dataset_snap = copy.deepcopy(self.test_data) del dataset_snap["public"] self.assertDictEqual(snap["data"], dataset_snap)
def test_delete_job(self): with self.assertRaises(dataset_eval.JobNotFoundException): dataset_eval.delete_job(self.test_uuid) job_id = dataset_eval._create_job(self.conn, self.test_dataset_id, True, dataset_eval.EVAL_LOCAL, c_value=[1, 2, 3], gamma_value=[4, 5, 6], preprocessing_values=["basic"], filter_type=None) snapshots = dataset.get_snapshots_for_dataset(self.test_dataset_id) self.assertEqual(len(snapshots), 1) self.assertIsNotNone(dataset_eval.get_job(job_id)) dataset_eval.delete_job(job_id) snapshots = dataset.get_snapshots_for_dataset(self.test_dataset_id) self.assertEqual(len(snapshots), 0) self.assertIsNone(dataset_eval.get_job(job_id))