@@ -79,7 +79,9 @@ def test_limit_and_skip_query_multiple_pages_with_break(self, mock_execute_query
7979 "queryV1" : {
8080 "data" : [
8181 {"id" : "1" , "name" : "entity1" },
82- {"id" : "2" , "name" : "entity2" }
82+ {"id" : "2" , "name" : "entity2" },
83+ {"id" : "3" , "name" : "entity3" },
84+ {"id" : "4" , "name" : "entity4" }
8385 ]
8486 }
8587 }
@@ -98,7 +100,7 @@ def test_limit_and_skip_query_multiple_pages_with_break(self, mock_execute_query
98100
99101 mock_execute_query .side_effect = [mock_response1 , mock_response2 ]
100102
101- result = self .client ._limit_and_skip_query ("FIND * LIMIT 10" )
103+ result = self .client ._limit_and_skip_query ("FIND * LIMIT 10" , skip = 3 )
102104
103105 # Should call twice, but break on second page
104106 assert mock_execute_query .call_count == 2
@@ -107,6 +109,8 @@ def test_limit_and_skip_query_multiple_pages_with_break(self, mock_execute_query
107109 assert result == {"data" : [
108110 {"id" : "1" , "name" : "entity1" },
109111 {"id" : "2" , "name" : "entity2" },
112+ {"id" : "3" , "name" : "entity3" },
113+ {"id" : "4" , "name" : "entity4" },
110114 {"id" : "3" , "name" : "entity3" }
111115 ]}
112116
@@ -134,8 +138,8 @@ def test_limit_and_skip_query_with_custom_skip_limit(self, mock_execute_query):
134138 # Verify the query was called with custom skip/limit
135139 mock_execute_query .assert_called_once ()
136140 call_args = mock_execute_query .call_args
137- query = call_args [0 ][ 0 ]
138- assert "SKIP 0 LIMIT 25" in query # First page starts at 0
141+ variables = call_args [1 ][ "variables" ]
142+ assert "SKIP 0 LIMIT 25" in variables [ " query" ] # First page starts at 0
139143
140144 # Verify the result
141145 assert result == {"data" : [
@@ -151,7 +155,9 @@ def test_limit_and_skip_query_multiple_pages_with_custom_values(self, mock_execu
151155 "queryV1" : {
152156 "data" : [
153157 {"id" : "1" , "name" : "entity1" },
154- {"id" : "2" , "name" : "entity2" }
158+ {"id" : "2" , "name" : "entity2" },
159+ {"id" : "3" , "name" : "entity3" },
160+ {"id" : "4" , "name" : "entity4" }
155161 ]
156162 }
157163 }
@@ -172,7 +178,7 @@ def test_limit_and_skip_query_multiple_pages_with_custom_values(self, mock_execu
172178
173179 result = self .client ._limit_and_skip_query (
174180 "FIND * LIMIT 10" ,
175- skip = 10 ,
181+ skip = 3 ,
176182 limit = 10
177183 )
178184
@@ -181,13 +187,15 @@ def test_limit_and_skip_query_multiple_pages_with_custom_values(self, mock_execu
181187
182188 # Verify the queries were called with correct skip values
183189 call_args_list = mock_execute_query .call_args_list
184- assert "SKIP 0 LIMIT 10" in call_args_list [0 ][0 ][ 0 ] # First page
185- assert "SKIP 10 LIMIT 10" in call_args_list [1 ][0 ][ 0 ] # Second page
190+ assert "SKIP 0 LIMIT 10" in call_args_list [0 ][1 ][ "variables" ][ "query" ] # First page
191+ assert "SKIP 3 LIMIT 10" in call_args_list [1 ][1 ][ "variables" ][ "query" ] # Second page
186192
187193 # Verify the result
188194 assert result == {"data" : [
189195 {"id" : "1" , "name" : "entity1" },
190196 {"id" : "2" , "name" : "entity2" },
197+ {"id" : "3" , "name" : "entity3" },
198+ {"id" : "4" , "name" : "entity4" },
191199 {"id" : "3" , "name" : "entity3" }
192200 ]}
193201
@@ -215,7 +223,7 @@ def test_limit_and_skip_query_with_include_deleted_true(self, mock_execute_query
215223 # Verify the query was called with includeDeleted=True
216224 mock_execute_query .assert_called_once ()
217225 call_args = mock_execute_query .call_args
218- variables = call_args [0 ][ 1 ]
226+ variables = call_args [1 ][ "variables" ]
219227 assert variables ["includeDeleted" ] is True
220228
221229 # Verify the result
@@ -248,7 +256,7 @@ def test_limit_and_skip_query_with_include_deleted_false(self, mock_execute_quer
248256 # Verify the query was called with includeDeleted=False
249257 mock_execute_query .assert_called_once ()
250258 call_args = mock_execute_query .call_args
251- variables = call_args [0 ][ 1 ]
259+ variables = call_args [1 ][ "variables" ]
252260 assert variables ["includeDeleted" ] is False
253261
254262 # Verify the result
@@ -305,11 +313,11 @@ def test_limit_and_skip_query_complex_query(self, mock_execute_query):
305313 # Verify the query was called with the complex query
306314 mock_execute_query .assert_called_once ()
307315 call_args = mock_execute_query .call_args
308- query = call_args [0 ][ 0 ]
309- assert "FIND aws_instance" in query
310- assert "THAT RELATES TO aws_vpc" in query
311- assert "WITH tag.Environment = 'production'" in query
312- assert "SKIP 0 LIMIT" in query # Should have skip/limit added
316+ variables = call_args [1 ][ "variables" ]
317+ assert "FIND aws_instance" in variables [ " query" ]
318+ assert "THAT RELATES TO aws_vpc" in variables [ " query" ]
319+ assert "WITH tag.Environment = 'production'" in variables [ " query" ]
320+ assert "SKIP 0 LIMIT" in variables [ " query" ] # Should have skip/limit added
313321
314322 # Verify the result
315323 assert result == {"data" : [
@@ -325,7 +333,9 @@ def test_limit_and_skip_query_pagination_math(self, mock_execute_query):
325333 "queryV1" : {
326334 "data" : [
327335 {"id" : "1" , "name" : "entity1" },
328- {"id" : "2" , "name" : "entity2" }
336+ {"id" : "2" , "name" : "entity2" },
337+ {"id" : "3" , "name" : "entity3" },
338+ {"id" : "4" , "name" : "entity4" }
329339 ]
330340 }
331341 }
@@ -337,7 +347,9 @@ def test_limit_and_skip_query_pagination_math(self, mock_execute_query):
337347 "queryV1" : {
338348 "data" : [
339349 {"id" : "3" , "name" : "entity3" },
340- {"id" : "4" , "name" : "entity4" }
350+ {"id" : "4" , "name" : "entity4" },
351+ {"id" : "5" , "name" : "entity5" },
352+ {"id" : "6" , "name" : "entity6" }
341353 ]
342354 }
343355 }
@@ -356,23 +368,27 @@ def test_limit_and_skip_query_pagination_math(self, mock_execute_query):
356368
357369 mock_execute_query .side_effect = [mock_response1 , mock_response2 , mock_response3 ]
358370
359- result = self .client ._limit_and_skip_query ("FIND * LIMIT 10" )
371+ result = self .client ._limit_and_skip_query ("FIND * LIMIT 10" , skip = 3 )
360372
361373 # Should call three times
362374 assert mock_execute_query .call_count == 3
363375
364376 # Verify the pagination math
365377 call_args_list = mock_execute_query .call_args_list
366- assert "SKIP 0 LIMIT" in call_args_list [0 ][0 ][ 0 ] # Page 0: SKIP 0
367- assert "SKIP 100 LIMIT" in call_args_list [1 ][0 ][ 0 ] # Page 1: SKIP 100
368- assert "SKIP 200 LIMIT" in call_args_list [2 ][0 ][ 0 ] # Page 2: SKIP 200
378+ assert "SKIP 0 LIMIT" in call_args_list [0 ][1 ][ "variables" ][ "query" ] # Page 0: SKIP 0
379+ assert "SKIP 3 LIMIT" in call_args_list [1 ][1 ][ "variables" ][ "query" ] # Page 1: SKIP 3
380+ assert "SKIP 6 LIMIT" in call_args_list [2 ][1 ][ "variables" ][ "query" ] # Page 2: SKIP 6
369381
370382 # Verify the result
371383 assert result == {"data" : [
372384 {"id" : "1" , "name" : "entity1" },
373385 {"id" : "2" , "name" : "entity2" },
374386 {"id" : "3" , "name" : "entity3" },
375387 {"id" : "4" , "name" : "entity4" },
388+ {"id" : "3" , "name" : "entity3" },
389+ {"id" : "4" , "name" : "entity4" },
390+ {"id" : "5" , "name" : "entity5" },
391+ {"id" : "6" , "name" : "entity6" },
376392 {"id" : "5" , "name" : "entity5" }
377393 ]}
378394
@@ -396,8 +412,8 @@ def test_limit_and_skip_query_default_constants(self, mock_execute_query):
396412 # Verify the query was called with default constants
397413 mock_execute_query .assert_called_once ()
398414 call_args = mock_execute_query .call_args
399- query = call_args [0 ][ 0 ]
400- assert f"SKIP 0 LIMIT { J1QL_LIMIT_COUNT } " in query
415+ variables = call_args [1 ][ "variables" ]
416+ assert f"SKIP 0 LIMIT { J1QL_LIMIT_COUNT } " in variables [ " query" ]
401417
402418 # Verify the result
403419 assert result == {"data" : [
0 commit comments