From cb824a49af9b0d155b89fe66a4cfebefe52beb7a Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Thu, 30 Dec 2021 12:34:50 -0800 Subject: fix: handle situation where GitLab does not return values If a query returns more than 10,000 records than the following values are NOT returned: x.total_pages x.total Modify the code to allow no value to be set for these values. If there is not a value returned the functions will now return None. Update unit test so no longer `xfail` https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers Closes #1686 --- tests/unit/test_gitlab.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'tests/unit') diff --git a/tests/unit/test_gitlab.py b/tests/unit/test_gitlab.py index 2981ebb..4d742d3 100644 --- a/tests/unit/test_gitlab.py +++ b/tests/unit/test_gitlab.py @@ -16,9 +16,9 @@ # You should have received a copy of the GNU Lesser General Public License # along with this program. If not, see . +import copy import pickle import warnings -from copy import deepcopy import pytest import responses @@ -109,7 +109,7 @@ def _strip_pagination_headers(response): """ https://docs.gitlab.com/ee/user/gitlab_com/index.html#pagination-response-headers """ - stripped = deepcopy(response) + stripped = copy.deepcopy(response) del stripped["headers"]["X-Total-Pages"] del stripped["headers"]["X-Total"] @@ -117,7 +117,6 @@ def _strip_pagination_headers(response): return stripped -@pytest.mark.xfail(reason="See #1686") @responses.activate def test_gitlab_build_list_missing_headers(gl, resp_page_1, resp_page_2): stripped_page_1 = _strip_pagination_headers(resp_page_1) -- cgit v1.2.1