def test_post(self): new_prep_id = get_count('qiita.prep_template') + 1 arguments = {'study_id': '1', 'data-type': '16S', 'prep-file': 'new_template.txt'} response = self.post('/prep_template/', arguments) self.assertEqual(response.code, 200) # Check that the new prep template has been created self.assertTrue(PrepTemplate.exists(new_prep_id))
def _check_prep_template_exists(prep_id): """Make sure a prep template exists in the system Parameters ---------- prep_id : int or str castable to int PrepTemplate id to check Returns ------- dict {'status': status, 'message': msg} """ if not PrepTemplate.exists(int(prep_id)): return {'status': 'error', 'message': 'Prep template %d does not exist' % int(prep_id) } return {'status': 'success', 'message': ''}
def _check_prep_template_exists(prep_id): """Make sure a prep template exists in the system Parameters ---------- prep_id : int or str castable to int PrepTemplate id to check Returns ------- dict {'status': status, 'message': msg} """ if not PrepTemplate.exists(int(prep_id)): return {'status': 'error', 'message': 'Prep template %d does not exist' % int(prep_id) } return {'status': 'success', 'message': ''}