def test_artifact_post_req(self): # Create new prep template to attach artifact to pt = npt.assert_warns( QiitaDBWarning, PrepTemplate.create, pd.DataFrame({'new_col': {'1.SKD6.640190': 1}}), Study(1), '16S') self._files_to_remove.extend([fp for _, fp in pt.get_filepaths()]) filepaths = {'raw_forward_seqs': 'uploaded_file.txt', 'raw_barcodes': 'update.txt'} obs = artifact_post_req( '*****@*****.**', filepaths, 'FASTQ', 'New Test Artifact', pt.id) exp = {'status': 'success', 'message': ''} self.assertEqual(obs, exp) wait_for_prep_information_job(pt.id) # Test importing an artifact # Create new prep template to attach artifact to pt = npt.assert_warns( QiitaDBWarning, PrepTemplate.create, pd.DataFrame({'new_col': {'1.SKD6.640190': 1}}), Study(1), '16S') self._files_to_remove.extend([fp for _, fp in pt.get_filepaths()]) obs = artifact_post_req( '*****@*****.**', {}, 'Demultiplexed', 'New Test Artifact 2', pt.id, 3) exp = {'status': 'success', 'message': ''} self.assertEqual(obs, exp) wait_for_prep_information_job(pt.id) # Instantiate the artifact to make sure it was made and # to clean the environment a = Artifact(pt.artifact.id) self._files_to_remove.extend([fp for _, fp, _ in a.filepaths])
def test_delete_artifact(self): response = self.post('/artifact/', {'artifact_id': 2}) self.assertEqual(response.code, 200) # This is needed so the clean up works - this is a distributed system # so we need to make sure that all processes are done before we reset # the test database wait_for_prep_information_job(1)
def test_artifact_delete_req(self): obs = artifact_delete_req(self.artifact.id, '*****@*****.**') exp = {'status': 'success', 'message': ''} self.assertEqual(obs, exp) # This is needed so the clean up works - this is a distributed system # so we need to make sure that all processes are done before we reset # the test database wait_for_prep_information_job(1)
def test_artifact_post_request(self): # No access with self.assertRaises(QiitaHTTPError): artifact_post_req(User('*****@*****.**'), 1) artifact_post_req(User('*****@*****.**'), 2) # Wait until the job is completed wait_for_prep_information_job(1) # Check that the delete function has been actually called obs = r_client.get(loads(r_client.get('prep_template_1'))['job_id']) self.assertIn('Cannot delete artifact 2', obs)
def test_artifact_post_request(self): # No access with self.assertRaises(QiitaHTTPError): artifact_post_req(User('*****@*****.**'), 1) obs = artifact_post_req(User('*****@*****.**'), 2) self.assertCountEqual(obs.keys(), ['job']) # Wait until the job is completed wait_for_prep_information_job(1) # Check that the delete function has been actually called job = ProcessingJob(loads(r_client.get('prep_template_1'))['job_id']) self.assertEqual(job.status, 'error') self.assertIn('Cannot delete artifact 2', job.log.msg)
def test_artifact_post_request(self): # No access with self.assertRaises(QiitaHTTPError): artifact_post_req(User('*****@*****.**'), 1) obs = artifact_post_req(User('*****@*****.**'), 2) self.assertEqual(obs.keys(), ['job']) # Wait until the job is completed wait_for_prep_information_job(1) # Check that the delete function has been actually called job = ProcessingJob(loads(r_client.get('prep_template_1'))['job_id']) self.assertEqual(job.status, 'error') self.assertIn('Cannot delete artifact 2', job.log.msg)
def test_post_artifact(self): args = { 'artifact-type': 'FASTQ', 'name': 'New Artifact Handler test', 'prep-template-id': self.prep.id, 'raw_forward_seqs': [self.fwd_fp], 'raw_barcodes': [self.barcodes_fp], 'raw_reverse_seqs': [], 'import-artifact': ''} response = self.post('/study/new_artifact/', args) self.assertEqual(response.code, 200) # make sure new artifact created wait_for_prep_information_job(self.prep.id)
def test_post_artifact(self): args = { 'artifact-type': 'FASTQ', 'name': 'New Artifact Handler test', 'prep-template-id': self.prep.id, 'raw_forward_seqs': [self.fwd_fp], 'raw_barcodes': [self.barcodes_fp], 'raw_reverse_seqs': [], 'import-artifact': '' } response = self.post('/study/new_artifact/', args) self.assertEqual(response.code, 200) # make sure new artifact created wait_for_prep_information_job(self.prep.id)
def test_post_artifact_ajax_handler(self): response = self.post('/artifact/2/', {}) self.assertEqual(response.code, 200) wait_for_prep_information_job(1)