diff --git a/posthog/tasks/exports/test/csv_renders/hogql_no_result.json b/posthog/tasks/exports/test/csv_renders/hogql_no_result.json new file mode 100644 index 0000000000000..098a3e68aaa53 --- /dev/null +++ b/posthog/tasks/exports/test/csv_renders/hogql_no_result.json @@ -0,0 +1,7 @@ +{ + "csv_rows": ["error", "No data available or unable to format for export.", ""], + "response": { + "columns": null, + "hasMore": null + } +} diff --git a/posthog/tasks/exports/test/test_csv_exporter_renders.py b/posthog/tasks/exports/test/test_csv_exporter_renders.py index a7bb21f834a18..89582d8984c83 100644 --- a/posthog/tasks/exports/test/test_csv_exporter_renders.py +++ b/posthog/tasks/exports/test/test_csv_exporter_renders.py @@ -62,7 +62,9 @@ def test_csv_rendering(mock_settings, mock_process_query, mock_request, filename elif fixture["response"].get("results") is not None: mock_process_query.return_value = fixture["response"] else: - mock_process_query.return_value = {"results": fixture["response"].pop("result"), **fixture["response"]} + mock_process_query.return_value = fixture["response"] + if "result" in fixture["response"]: + mock_process_query.return_value["results"] = fixture["response"].pop("result") csv_exporter.export_tabular(asset) csv_rows = asset.content.decode("utf-8").split("\r\n")