Gap
Paginator is a core feature — it's the engine behind every .all() call in the library — but it has zero direct unit
tests. It's only exercised indirectly through integration tests like test_customers_all_pages, which test the full HTTP
stack rather than the pagination logic itself.
Tests Added
tests/paginator_test.py covers the paginator in isolation using unittest.mock (no HTTP mocking needed):
| Test |
What it proves |
test_single_page_yields_all_records |
Stops after one fetch when no after cursor |
test_multiple_pages_follows_cursor |
Follows cursors until None, collects all records |
test_after_cursor_passed_to_next_fetch |
Cursor value actually makes it into the next request params |
test_empty_page_yields_nothing |
Graceful handling of empty responses |
test_params_passed_to_service |
Filter params reach the service |
test_identity_params_passed_to_service |
Nested resource params (e.g. creditor_id) pass through correctly |
test_original_params_not_mutated |
The params dict passed in isn't modified during iteration |
collected 7 items
tests/paginator_test.py::test_single_page_yields_all_records PASSED
tests/paginator_test.py::test_multiple_pages_follows_cursor PASSED
tests/paginator_test.py::test_after_cursor_passed_to_next_fetch PASSED
tests/paginator_test.py::test_empty_page_yields_nothing PASSED
tests/paginator_test.py::test_params_passed_to_service PASSED
tests/paginator_test.py::test_identity_params_passed_to_service PASSED
tests/paginator_test.py::test_original_params_not_mutated PASSED
7 passed in 0.31s
PR Ready
Branch at ausbernard/gocardless-pro-python → chore/paginator-test. Same collaborator access situation as my
previous issue — happy to contribute if a PR can be opened.
Gap
Paginatoris a core feature — it's the engine behind every.all()call in the library — but it has zero direct unittests. It's only exercised indirectly through integration tests like
test_customers_all_pages, which test the full HTTPstack rather than the pagination logic itself.
Tests Added
tests/paginator_test.pycovers the paginator in isolation usingunittest.mock(no HTTP mocking needed):test_single_page_yields_all_recordsaftercursortest_multiple_pages_follows_cursorNone, collects all recordstest_after_cursor_passed_to_next_fetchtest_empty_page_yields_nothingtest_params_passed_to_servicetest_identity_params_passed_to_servicecreditor_id) pass through correctlytest_original_params_not_mutatedPR Ready
Branch at
ausbernard/gocardless-pro-python→chore/paginator-test. Same collaborator access situation as myprevious issue — happy to contribute if a PR can be opened.