Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- **`list_idvs()`, `list_idv_awards()`, `list_idv_child_idvs()` and `list_idv_transactions()` now return the API's pagination `cursor`.** They dropped it, so `response.cursor` was always `None` and a caller following the cursor stopped after the first page.

## [1.11.0] - 2026-09-29

### Added
Expand Down
4 changes: 4 additions & 0 deletions tango/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,6 +986,7 @@ def list_idvs(
next=data.get("next"),
previous=data.get("previous"),
results=results,
cursor=data.get("cursor"),
page_metadata=data.get("page_metadata"),
meta=data.get("meta"),
)
Expand Down Expand Up @@ -1088,6 +1089,7 @@ def list_idv_awards(
next=data.get("next"),
previous=data.get("previous"),
results=results,
cursor=data.get("cursor"),
page_metadata=data.get("page_metadata"),
meta=data.get("meta"),
)
Expand Down Expand Up @@ -1133,6 +1135,7 @@ def list_idv_child_idvs(
next=data.get("next"),
previous=data.get("previous"),
results=results,
cursor=data.get("cursor"),
page_metadata=data.get("page_metadata"),
meta=data.get("meta"),
)
Expand All @@ -1150,6 +1153,7 @@ def list_idv_transactions(
next=data.get("next"),
previous=data.get("previous"),
results=data.get("results") or [],
cursor=data.get("cursor"),
page_metadata=data.get("page_metadata"),
meta=data.get("meta"),
)
Expand Down
28 changes: 28 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,34 @@ def test_list_otas_with_default_shape(self, mock_request):
assert otas.results[0]["key"] == "OTA-1"
assert otas.cursor == "next-page-token"

@pytest.mark.parametrize(
("method", "args"),
[
("list_idvs", ()),
("list_idv_awards", ("IDV-1",)),
("list_idv_child_idvs", ("IDV-1",)),
("list_idv_transactions", ("IDV-1",)),
],
)
@patch("tango.client.httpx.Client.request")
def test_idv_list_methods_return_cursor(self, mock_request, method, args):
mock_response = Mock()
mock_response.is_success = True
mock_response.json.return_value = {
"count": 250,
"next": "https://tango.makegov.com/api/idvs/?cursor=next-page-token",
"previous": None,
"results": [{"key": "IDV-1"}],
"cursor": "next-page-token",
}
mock_response.content = b'{"count": 250}'
mock_request.return_value = mock_response

client = TangoClient(api_key="test-key")
page = getattr(client, method)(*args, limit=1)

assert page.cursor == "next-page-token"

@patch("tango.client.httpx.Client.request")
def test_list_otidvs_with_default_shape(self, mock_request):
"""Test list_otidvs uses default minimal shape"""
Expand Down
Loading