Skip to content

Commit

Permalink
fix #2069 - adding tests
Browse files Browse the repository at this point in the history
  • Loading branch information
antgonza committed Apr 29, 2017
1 parent 4ecff71 commit cde1294
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions qiita_pet/handlers/study_handlers/tests/test_listing_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,37 @@ def setUp(self):
self.exp = [self.single_exp]

def test_build_study_info(self):
for a in Study(1).artifacts():
a.visibility='private'

obs = _build_study_info(User('test@foo.bar'), 'user')
self.assertEqual(obs, self.exp)

obs = _build_study_info(User('test@foo.bar'), 'public')
self.assertEqual(obs, [])

obs = _build_study_info(User('demo@microbio.me'), 'public')
self.assertEqual(obs, [])

# make all the artifacts public - (1) the only study in the tests,
for a in Study(1).artifacts():
a.visibility='public'
self.exp[0]['status'] = 'public'

obs = _build_study_info(User('test@foo.bar'), 'user')
self.assertEqual(obs, self.exp)

obs = _build_study_info(User('test@foo.bar'), 'public')
self.assertEqual(obs, [])

obs = _build_study_info(User('demo@microbio.me'), 'public')
self.assertEqual(obs, self.exp)

# return to it's private status
for a in Study(1).artifacts():
a.visibility='private'


def test_build_study_info_erros(self):
with self.assertRaises(IncompetentQiitaDeveloperError):
_build_study_info(User('test@foo.bar'), 'user', study_proc={})
Expand Down

0 comments on commit cde1294

Please sign in to comment.