diff --git a/CHANGELOG.md b/CHANGELOG.md index 96f01a8..070adb9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tango/client.py b/tango/client.py index 91f99e6..846fe8f 100644 --- a/tango/client.py +++ b/tango/client.py @@ -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"), ) @@ -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"), ) @@ -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"), ) @@ -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"), ) diff --git a/tests/test_client.py b/tests/test_client.py index 3ce0f1b..c125b37 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -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"""