@@ -999,6 +999,47 @@ async def test_cognite_client_is_not_set(self, api_client_with_token: APIClient,
999999 with pytest .raises (AttributeError ):
10001000 res2 ._cognite_client # type: ignore[attr-defined]
10011001
1002+ async def test_list_generator_does_not_send_null_cursor (
1003+ self , api_client_with_token : APIClient , httpx_mock : HTTPXMock
1004+ ) -> None :
1005+ httpx_mock .add_response (
1006+ method = "POST" ,
1007+ url = BASE_URL + URL_PATH + "/list" ,
1008+ status_code = 200 ,
1009+ json = {"items" : [{"x" : 1 , "y" : 2 }]},
1010+ )
1011+ async for _ in api_client_with_token ._list_generator (
1012+ method = "POST" ,
1013+ list_cls = SomeResourceListWithClient ,
1014+ resource_cls = SomeResourceWithClient ,
1015+ resource_path = URL_PATH ,
1016+ ):
1017+ pass
1018+ body = jsgz_load (httpx_mock .get_requests ()[0 ].content )
1019+ assert "cursor" not in body
1020+
1021+ async def test_list_generator_raw_responses_does_not_send_null_cursor (
1022+ self , api_client_with_token : APIClient , httpx_mock : HTTPXMock
1023+ ) -> None :
1024+ httpx_mock .add_response (
1025+ method = "POST" ,
1026+ url = BASE_URL + URL_PATH + "/list" ,
1027+ status_code = 200 ,
1028+ json = {"items" : [{"x" : 1 , "y" : 2 }]},
1029+ )
1030+ responses = [
1031+ r
1032+ async for r in api_client_with_token ._list_generator_raw_responses (
1033+ method = "POST" ,
1034+ settings_forcing_raw_response_loading = ["include_typing" ],
1035+ resource_path = URL_PATH ,
1036+ chunk_size = api_client_with_token ._LIST_LIMIT ,
1037+ )
1038+ ]
1039+ assert len (responses ) == 1
1040+ body = jsgz_load (httpx_mock .get_requests ()[0 ].content )
1041+ assert "cursor" not in body
1042+
10021043
10031044class TestStandardAggregate :
10041045 async def test_standard_aggregate_OK (self , api_client_with_token : APIClient , httpx_mock : HTTPXMock ) -> None :
0 commit comments