def test_exists(self): qiita_config.portal = 'QIITA' self.assertTrue(Analysis.exists(1)) new_id = get_count("qiita.analysis") + 1 self.assertFalse(Analysis.exists(new_id)) qiita_config.portal = 'EMP' self.assertFalse(Analysis.exists(1)) new_id = get_count("qiita.analysis") + 1 self.assertFalse(Analysis.exists(new_id))
def test_delete_study(self): # as samples have been submitted to EBI, this will fail job = self._create_job('delete_study', {'study': 1}) private_task(job.id) self.assertEqual(job.status, 'error') self.assertIn( "Cannot delete artifact 2: Artifact 2 has been " "submitted to EBI", job.log.msg) # making sure the analysis, first thing to delete, still exists self.assertTrue(Analysis.exists(1)) # delete everything from the EBI submissions and the processing job so # we can try again: test success (with tags) with TRN: sql = """DELETE FROM qiita.ebi_run_accession""" TRN.add(sql) sql = """DELETE FROM qiita.artifact_processing_job""" TRN.add(sql) TRN.execute() # adding tags Study(1).update_tags(self.user, ['my new tag!']) job = self._create_job('delete_study', {'study': 1}) private_task(job.id) self.assertEqual(job.status, 'success') with self.assertRaises(QiitaDBUnknownIDError): Study(1)
def test_delete_study(self): # as samples have been submitted to EBI, this will fail job = self._create_job('delete_study', {'study': 1}) private_task(job.id) self.assertEqual(job.status, 'error') self.assertIn("Cannot delete artifact 2: Artifact 2 has been " "submitted to EBI", job.log.msg) # making sure the analysis, first thing to delete, still exists self.assertTrue(Analysis.exists(1)) # delete everything from the EBI submissions and the processing job so # we can try again: test success (with tags) with TRN: sql = """DELETE FROM qiita.ebi_run_accession""" TRN.add(sql) sql = """DELETE FROM qiita.artifact_processing_job""" TRN.add(sql) TRN.execute() # adding tags Study(1).update_tags(self.user, ['my new tag!']) job = self._create_job('delete_study', {'study': 1}) private_task(job.id) self.assertEqual(job.status, 'success') with self.assertRaises(QiitaDBUnknownIDError): Study(1)
def test_delete_study(self): # as samples have been submitted to EBI, this will fail job = self._create_job('delete_study', {'study': 1}) private_task(job.id) self.assertEqual(job.status, 'error') self.assertIn("Artifact 2 has been submitted to EBI", job.log.msg) # making sure the analysis, first thing to delete, still exists self.assertTrue(Analysis.exists(1)) info = { "timeseries_type_id": '1', "metadata_complete": 'true', "mixs_compliant": 'true', "study_alias": "FCM", "study_description": "Microbiome of people who eat nothing but " "fried chicken", "study_abstract": "Exploring how a high fat diet changes the " "gut microbiome", "principal_investigator_id": StudyPerson(3), "lab_person_id": StudyPerson(1) } new_study = Study.create(User('*****@*****.**'), "Fried Chicken Microbiome %s" % time(), info) # adding tags new_study.update_tags(User('*****@*****.**'), ['my new tag!']) # creating a sample information file metadata = pd.DataFrame.from_dict( { 'Sample1': { 'physical_specimen_location': 'location1', 'taxon_id': '9606', 'scientific_name': 'h**o sapiens' }, 'Sample2': { 'physical_specimen_location': 'location1', 'taxon_id': '9606', 'scientific_name': 'h**o sapiens' }, 'Sample3': { 'physical_specimen_location': 'location1', 'taxon_id': '9606', 'scientific_name': 'h**o sapiens' } }, orient='index') SampleTemplate.create(metadata, new_study) # creating a preparation information file metadata = pd.DataFrame.from_dict( { 'Sample1': { 'center_name': 'ANL', 'target_subfragment': 'V4', 'center_project_name': 'Test Project' } }, orient='index', dtype=str) PrepTemplate.create(metadata, new_study, '16S') job = self._create_job('delete_study', {'study': new_study.id}) private_task(job.id) self.assertEqual(job.status, 'success') # making sure the study doesn't exist with self.assertRaises(QiitaDBUnknownIDError): Study(new_study.id)
def test_exists(self): self.assertTrue(Analysis.exists(1)) new_id = get_count("qiita.analysis") + 1 self.assertFalse(Analysis.exists(new_id))