| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3c7c7fc commit 585e3a8
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -393,6 +393,9 @@ The generator exposes extra listing information as received from the server: | |||
| 393 | 393 | Prior to python-gitlab 3.6.0 the argument ``as_list`` was used instead of | |
| 394 | 394 | ``iterator``. ``as_list=False`` is the equivalent of ``iterator=True``. | |
| 395 | 395 | ||
| 396 | + .. note:: | ||
| 397 | + If ``page`` and ``iterator=True`` are used together, the latter is ignored. | ||
| 398 | + | ||
| 396 | 399 | Sudo | |
| 397 | 400 | ==== | |
| 398 | 401 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -929,7 +929,7 @@ def http_list( | |||
| 929 | 929 | ||
| 930 | 930 | page = kwargs.get("page") | |
| 931 | 931 | ||
| 932 | - if iterator: | ||
| 932 | + if iterator and page is None: | ||
| 933 | 933 | # Generator requested | |
| 934 | 934 | return GitlabList(self, url, query_data, **kwargs) | |
| 935 | 935 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -542,6 +542,18 @@ def test_list_request(gl): | |||
| 542 | 542 | assert responses.assert_call_count(url, 3) is True | |
| 543 | 543 | ||
| 544 | 544 | ||
| 545 | + @responses.activate | ||
| 546 | + def test_list_request_page_and_iterator(gl): | ||
| 547 | + response_dict = copy.deepcopy(large_list_response) | ||
| 548 | + response_dict["match"] = [responses.matchers.query_param_matcher({"page": "1"})] | ||
| 549 | + responses.add(**response_dict) | ||
| 550 | + | ||
| 551 | + result = gl.http_list("/projects", iterator=True, page=1) | ||
| 552 | + assert isinstance(result, list) | ||
| 553 | + assert len(result) == 20 | ||
| 554 | + assert len(responses.calls) == 1 | ||
| 555 | + | ||
| 556 | + | ||
| 545 | 557 | large_list_response = { | |
| 546 | 558 | "method": responses.GET, | |
| 547 | 559 | "url": "http://localhost/api/v4/projects", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments