diff options
| author | Helen Koike <helen.koike@collabora.com> | 2023-01-23 08:55:35 -0300 |
|---|---|---|
| committer | John Villalovos <john@sodarock.com> | 2023-01-25 09:18:48 -0800 |
| commit | 585e3a86c4cafa9ee73ed38676a78f3c34dbe6b2 (patch) | |
| tree | d12b2c52a6665c3f56dad5e231d0c87f9d8b26b2 /tests | |
| parent | 3c7c7fc9d2375d3219fb078e18277d7476bae5e0 (diff) | |
| download | gitlab-585e3a86c4cafa9ee73ed38676a78f3c34dbe6b2.tar.gz | |
fix(client): regression - do not automatically get_next if page=# and
iterator=True/as_list=False are used
This fix a regression introduced on commit
https://github.com/python-gitlab/python-gitlab/commit/1339d645ce58a2e1198b898b9549ba5917b1ff12
If page is used, then get_next should be false.
This was found on the mesa ci project, after upgrading the python-gitlab
version, the script that monitors the ci was getting killed by consuming
too much memory.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit/test_gitlab_http_methods.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/unit/test_gitlab_http_methods.py b/tests/unit/test_gitlab_http_methods.py index dc1aef2..9b9799c 100644 --- a/tests/unit/test_gitlab_http_methods.py +++ b/tests/unit/test_gitlab_http_methods.py @@ -542,6 +542,18 @@ def test_list_request(gl): assert responses.assert_call_count(url, 3) is True +@responses.activate +def test_list_request_page_and_iterator(gl): + response_dict = copy.deepcopy(large_list_response) + response_dict["match"] = [responses.matchers.query_param_matcher({"page": "1"})] + responses.add(**response_dict) + + result = gl.http_list("/projects", iterator=True, page=1) + assert isinstance(result, list) + assert len(result) == 20 + assert len(responses.calls) == 1 + + large_list_response = { "method": responses.GET, "url": "http://localhost/api/v4/projects", |
