diff --git a/narps_open/utils/status.py b/narps_open/utils/status.py index 96d4265f..6dced5bc 100644 --- a/narps_open/utils/status.py +++ b/narps_open/utils/status.py @@ -26,7 +26,7 @@ def get_opened_issues(): # Get all opened issues request_url = 'https://api.github.com/repos/Inria-Empenn/narps_open_pipelines/issues' - request_url += '?page={page_number}?per_page=30' + request_url += '?page={page_number}' issues = [] page = True # Will later be replaced by a table @@ -39,10 +39,6 @@ def get_opened_issues(): issues += page page_number += 1 - # Leave if there is only one page (in this case, the `page` query parameter has no effect) - if nb_issues < 30: - break - return issues def get_teams_with_pipeline_files(): diff --git a/tests/utils/test_status.py b/tests/utils/test_status.py index 42f9f584..17170b71 100644 --- a/tests/utils/test_status.py +++ b/tests/utils/test_status.py @@ -108,9 +108,12 @@ def mocked_requests_get_4(url, params=None, **kwargs): if 'issues' not in url: def mocked_json(): return mocked_repo_info_4 - else: + elif '?page=1' in url: def mocked_json(): return mocked_issues_4 + else: + def mocked_json(): + return [] response.json = mocked_json return response @@ -189,7 +192,6 @@ def test_get_issues(mocker): # General usecase 4 issues mocker.patch('narps_open.utils.status.get', side_effect = mocked_requests_get_4) - issues = get_opened_issues() assert len(issues) == 4 assert issues[0]['html_url'] == 'url_issue_2'