CP-2451 fix tests

This commit is contained in:
Rodrigo Rodrigues 2026-01-22 09:56:49 +00:00
parent 3ad6e074bf
commit 3182612069

View File

@ -14,8 +14,7 @@ def test_iterator_uses_cursor_from_next_href():
else:
links = SimpleNamespace(next=None)
items = ["third"]
data = SimpleNamespace(links=links)
return SimpleNamespace(data=data, items=items)
return SimpleNamespace(links=links, items=items)
responses = list(PaginatorIterator(method, lambda response: response.items))
@ -29,12 +28,12 @@ def test_iterator_reads_cursor_from_links_mapping():
def method(**params):
calls.append(params.copy())
if params.get("pageCursor") is None:
data = {"_links": {"next": {"href": "https://example.com?foo=1&pageCursor=xyz"}}}
links = {"next": {"href": "https://example.com?foo=1&pageCursor=xyz"}}
items = ["alpha"]
else:
data = {"_links": {"next": None}}
links = {"next": None}
items = ["beta"]
return SimpleNamespace(data=data, items=items)
return SimpleNamespace(links=links, items=items)
responses = list(PaginatorIterator(method, lambda response: response.items, cursor_param="pageCursor"))
@ -48,12 +47,12 @@ def test_iterator_stops_when_no_cursor_param_present():
def method(**params):
calls.append(params.copy())
if params.get("cursor") is None:
data = {"links": {"next": "/next/page"}}
links = {"next": "/next/page"}
items = ["one"]
else:
data = {"links": {"next": None}}
links = {"next": None}
items = ["two"]
return SimpleNamespace(data=data, items=items)
return SimpleNamespace(links=links, items=items)
responses = list(PaginatorIterator(method, lambda response: response.items))
@ -66,8 +65,8 @@ def test_iterator_stops_on_repeated_cursor():
def method(**params):
calls.append(params.copy())
data = {"links": {"next": "https://example.com?cursor=same"}}
return SimpleNamespace(data=data, items=["only"])
links = {"next": "https://example.com?cursor=same"}
return SimpleNamespace(links=links, items=["only"])
responses = list(PaginatorIterator(method, lambda response: response.items, cursor="same"))