File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,16 +57,24 @@ async def _ensure_pagination_events(nc_mcp: McpTestHelper) -> None:
5757 generates random server-side UUIDs, so a UID-based check would think no
5858 events exist and add a fresh batch on every run, accumulating duplicates.
5959 """
60- result = json .loads (
61- await nc_mcp .call (
62- "get_events" ,
63- calendar_id = "personal" ,
64- start = "2027-06-01T00:00:00Z" ,
65- end = "2027-06-30T23:59:59Z" ,
66- limit = 500 ,
60+ expected_summaries = {f"Pagination Test Event { i :03d} " for i in range (1 , ITEM_COUNT + 1 )}
61+ existing_summaries : set [str ] = set ()
62+ offset = 0
63+ while True :
64+ result = json .loads (
65+ await nc_mcp .call (
66+ "get_events" ,
67+ calendar_id = "personal" ,
68+ start = "2027-06-01T00:00:00Z" ,
69+ end = "2027-06-30T23:59:59Z" ,
70+ limit = 500 ,
71+ offset = offset ,
72+ )
6773 )
68- )
69- existing_summaries = {e .get ("summary" , "" ) for e in result ["data" ]}
74+ existing_summaries .update (e .get ("summary" , "" ) for e in result ["data" ])
75+ if not result ["pagination" ]["has_more" ] or expected_summaries .issubset (existing_summaries ):
76+ break
77+ offset += 500
7078 for i in range (1 , ITEM_COUNT + 1 ):
7179 summary = f"Pagination Test Event { i :03d} "
7280 if summary not in existing_summaries :
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ async def test_search_pagination(self, nc_mcp: McpTestHelper) -> None:
111111 assert len (first ["entries" ]) <= limit
112112 if not first ["has_more" ]:
113113 pytest .skip ("Not enough pagtest files seeded for a multi-page search" )
114+ assert first ["cursor" ], "has_more is true, so the response must carry a cursor"
114115
115116 seen = {e ["title" ] for e in first ["entries" ]}
116117 cursor = str (first ["cursor" ])
@@ -126,6 +127,7 @@ async def test_search_pagination(self, nc_mcp: McpTestHelper) -> None:
126127 pages += 1
127128 if not data ["has_more" ]:
128129 break
130+ assert data ["cursor" ], "has_more is true, so the response must carry a cursor"
129131 next_cursor = str (data ["cursor" ])
130132 assert next_cursor != cursor , "Cursor must advance across pages"
131133 cursor = next_cursor
You can’t perform that action at this time.
0 commit comments