Skip to content

Commit 33054b2

Browse files
authored
Merge pull request #2296 from antgonza/awaiting_approval-list
fix awaiting_approval list bug
2 parents d5ecf8a + 20226ed commit 33054b2

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

qiita_pet/handlers/study_handlers/listing_handlers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ def _build_study_info(user, search_type, study_proc=None, proc_samples=None):
7272
if user.level == 'admin':
7373
user_study_set = (user_study_set |
7474
Study.get_by_status('sandbox') |
75-
Study.get_by_status('private') -
75+
Study.get_by_status('private') |
76+
Study.get_by_status('awaiting_approval') -
7677
Study.get_by_status('public'))
7778
study_set = user_study_set
7879
elif search_type == 'public':

qiita_pet/handlers/study_handlers/tests/test_listing_handlers.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ def test_build_study_info(self):
7474
obs = _build_study_info(User('[email protected]'), 'public')
7575
self.assertEqual(obs, [])
7676

77+
obs = _build_study_info(User('[email protected]'), 'user')
78+
self.assertEqual(obs, self.exp)
79+
7780
# make all the artifacts public - (1) the only study in the tests,
7881
for a in Study(1).artifacts():
7982
a.visibility = 'public'
@@ -88,6 +91,28 @@ def test_build_study_info(self):
8891
obs = _build_study_info(User('[email protected]'), 'public')
8992
self.assertEqual(obs, self.exp)
9093

94+
obs = _build_study_info(User('[email protected]'), 'user')
95+
self.assertEqual(obs, [])
96+
97+
# make all the artifacts awaiting_approval - (1) the only study
98+
# in the tests,
99+
for a in Study(1).artifacts():
100+
a.visibility = 'awaiting_approval'
101+
self.exp[0]['status'] = 'awaiting_approval'
102+
103+
obs = _build_study_info(User('[email protected]'), 'user')
104+
self.assertEqual(obs, self.exp)
105+
106+
obs = _build_study_info(User('[email protected]'), 'public')
107+
self.assertEqual(obs, [])
108+
109+
obs = _build_study_info(User('[email protected]'), 'public')
110+
self.assertEqual(obs, [])
111+
112+
obs = _build_study_info(User('[email protected]'), 'user')
113+
self.assertEqual(obs, self.exp)
114+
115+
# awaiting_approval
91116
# return to it's private status
92117
for a in Study(1).artifacts():
93118
a.visibility = 'private'

0 commit comments

Comments
 (0)