aminghadersohi commented on code in PR #44218:
URL: https://github.com/apache/superset/pull/44218#discussion_r4014507304


##########
tests/unit_tests/tasks/test_export_dashboard_excel.py:
##########
@@ -839,3 +840,43 @@ def test_inflight_lock_released_on_failure(mocks: 
dict[str, Any]) -> None:
         "excel_export", {"user_id": 2, "dashboard_id": 1}
     )
     mocks["ReleaseDistributedLock"].return_value.run.assert_called_once_with()
+
+
[email protected]("query_mode", ["aggregate", "raw"])
+def test_rebuilt_paginated_table_executes_full_limit(
+    mocks: dict[str, Any], query_mode: str
+) -> None:
+    """The real export path sends one full-limit query to ChartDataCommand."""
+    form_data = {
+        "groupby": ["country"],
+        "all_columns": ["country"],
+        "metrics": ["count"],
+        "query_mode": query_mode,
+        "server_pagination": True,
+        "server_page_length": 10,
+        "row_limit": 1000,
+        "result_format": "json",
+        "result_type": "full",
+    }
+    chart = _rebuildable_chart(form_data=form_data)
+    mocks["get_charts_in_layout_order"].return_value = [chart]
+    mocks["ChartDataCommand"].return_value.run.return_value = {
+        "queries": [{"colnames": ["country"], "data": [{"country": "US"}]}]
+    }
+
+    with _builder_hook(None):
+        _run()
+
+    payload = 
mocks["ChartDataQueryContextSchema"].return_value.load.call_args.args[0]
+    assert payload["result_format"] == ChartDataResultFormat.JSON
+    assert payload["result_type"] == ChartDataResultType.FULL
+    assert len(payload["queries"]) == 1
+    query = payload["queries"][0]
+    assert query["row_limit"] == 1000
+    assert query.get("row_offset", 0) == 0

Review Comment:
   Addressed in 1714632f95. The production-path fixture now starts with 
`row_offset: 20` and still asserts the rebuilt command query has offset 0; the 
focused suite passes (49 tests).



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to