Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion qiita_pet/handlers/study_handlers/listing_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ def _build_study_info(user, search_type, study_proc=None, proc_samples=None):
if user.level == 'admin':
user_study_set = (user_study_set |
Study.get_by_status('sandbox') |
Study.get_by_status('private') -
Study.get_by_status('private') |
Study.get_by_status('awaiting_approval') -
Study.get_by_status('public'))
study_set = user_study_set
elif search_type == 'public':
Expand Down
25 changes: 25 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 @@ -74,6 +74,9 @@ def test_build_study_info(self):
obs = _build_study_info(User('demo@microbio.me'), 'public')
self.assertEqual(obs, [])

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

# make all the artifacts public - (1) the only study in the tests,
for a in Study(1).artifacts():
a.visibility = 'public'
Expand All @@ -88,6 +91,28 @@ def test_build_study_info(self):
obs = _build_study_info(User('demo@microbio.me'), 'public')
self.assertEqual(obs, self.exp)

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

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

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, [])

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

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