Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed May 12, 2023
1 parent 418fd10 commit 54b69ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qiita_db/handlers/tests/test_prep_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,23 @@ def test_post(self):
self.assertCountEqual(obs.keys(), ['prep'])

pt = qdb.metadata_template.prep_template.PrepTemplate(obs['prep'])
# default name
self.assertTrue(pt.name.startswith('Prep information'))
self.assertCountEqual(pt.keys(), ['1.SKB8.640193', '1.SKD8.640184'])

# testing that a new prep doesn't break the call due to empty artifact
obs = self.get('/qiita_db/prep_template/%d/' % pt.id,
headers=self.header)
self.assertEqual(obs.code, 200)

# testing that using a non default value actually works
data['name'] = 'my long and informative name'
obs = self.post('/apitest/prep_template/', headers=self.header,
data=data)
obs = loads(obs.body)
pt = qdb.metadata_template.prep_template.PrepTemplate(obs['prep'])
self.assertEqual(pt.name, data['name'])


if __name__ == '__main__':
main()

0 comments on commit 54b69ad

Please sign in to comment.