@@ -382,5 +382,59 @@ class TestEBISubmitHandler(TestHandlerBase):
382382 pass
383383
384384
385+ class TestDelete (TestHandlerBase ):
386+ database = True
387+
388+ def test_delete_sample_template (self ):
389+ response = self .post ('/study/description/1' ,
390+ {'sample_template_id' : 1 ,
391+ 'action' : 'delete_sample_template' })
392+ self .assertEqual (response .code , 200 )
393+
394+ # checking that the action was sent
395+ self .assertIn ("Sample template can not be erased because there are "
396+ "raw datas" , response .body )
397+
398+ def test_delete_raw_data (self ):
399+ response = self .post ('/study/description/1' ,
400+ {'raw_data_id' : 1 ,
401+ 'action' : 'delete_raw_data' })
402+ self .assertEqual (response .code , 200 )
403+
404+ # checking that the action was sent
405+ self .assertIn ("Raw data 1 has prep template(s) associated so it can't "
406+ "be erased" , response .body )
407+
408+ def test_delete_prep_template (self ):
409+ response = self .post ('/study/description/1' ,
410+ {'prep_template_id' : 1 ,
411+ 'action' : 'delete_prep_template' })
412+ self .assertEqual (response .code , 200 )
413+
414+ # checking that the action was sent
415+ self .assertIn ('Cannot remove prep template 1 because a preprocessed '
416+ 'data has been already generated using it.' ,
417+ response .body )
418+
419+ def test_delete_preprocessed_data (self ):
420+ response = self .post ('/study/description/1' ,
421+ {'preprocessed_data_id' : 1 ,
422+ 'action' : 'delete_preprocessed_data' })
423+ self .assertEqual (response .code , 200 )
424+
425+ # checking that the action was sent
426+ self .assertIn ('Illegal operation on non sandboxed preprocessed data' ,
427+ response .body )
428+
429+ def test_delete_processed_data (self ):
430+ response = self .post ('/study/description/1' ,
431+ {'processed_data_id' : 1 ,
432+ 'action' : 'delete_processed_data' })
433+ self .assertEqual (response .code , 200 )
434+
435+ # checking that the action was sent
436+ self .assertIn ('Illegal operation on non sandboxed processed data' ,
437+ response .body )
438+
385439if __name__ == "__main__" :
386440 main ()
0 commit comments