rjgoyln commented on code in PR #70989:
URL: https://github.com/apache/airflow/pull/70989#discussion_r3714404601
##########
airflow-ctl/tests/airflow_ctl/api/test_operations.py:
##########
@@ -250,6 +250,23 @@ def
test_execute_list_sends_limit_on_subsequent_pages(self):
for call in mock_client.get.call_args_list:
assert call.kwargs["params"]["limit"] == 2
+ def test_execute_list_sends_offset_to_server(self):
+ """``offset`` must reach the server on the first request, not only on
subsequent pages."""
+ mock_client = Mock()
+ mock_client.get.side_effect = [
+ Mock(content=json.dumps({"hellos": [{"name": "c"}, {"name": "d"}],
"total_entries": 6})),
+ Mock(content=json.dumps({"hellos": [{"name": "e"}, {"name": "f"}],
"total_entries": 6})),
+ ]
+ base_operation = BaseOperations(client=mock_client)
+
+ response = base_operation.execute_list(
+ path="hello", data_model=HelloCollectionResponse, offset=2, limit=2
+ )
+
+ assert [call.kwargs["params"]["offset"] for call in
mock_client.get.call_args_list] == [2, 4]
+ # The paging loop resumes at offset + limit, so a dropped offset also
skips rows 2-3.
Review Comment:
Thank you so much! I had never considered that before, and I learned a lot.
You're so kind. I really appreciate your help!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]