Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/gooddata-sdk/src/gooddata_sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
ExportCustomOverride,
ExportRequest,
ExportSettings,
GrandTotalsPosition,
SlidesExportRequest,
VisualExportRequest,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# (C) 2023 GoodData Corporation
from __future__ import annotations

from typing import Literal

from attrs import define
Expand All @@ -12,6 +14,8 @@

from gooddata_sdk.catalog.base import Base

GrandTotalsPosition = Literal["pinnedBottom", "pinnedTop", "bottom", "top"]


@define(kw_only=True)
class ExportCustomLabel(Base):
Expand Down Expand Up @@ -46,6 +50,7 @@ def client_class() -> type[ApiCustomOverride]:
class ExportSettings(Base):
merge_headers: bool
show_filters: bool
grand_totals_position: GrandTotalsPosition | None = None

@staticmethod
def client_class() -> type[ApiSettings]:
Expand Down
19 changes: 19 additions & 0 deletions packages/gooddata-sdk/tests/export/test_export_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
import os
from pathlib import Path

import pytest

from gooddata_sdk import (
Attribute,
ExecutionDefinition,
ExportCustomLabel,
ExportCustomMetric,
ExportCustomOverride,
ExportRequest,
ExportSettings,
GoodDataSdk,
ObjId,
SimpleMetric,
Expand Down Expand Up @@ -89,6 +92,22 @@ def _tabular_by_visualization_id_base(test_config, export_format: str):
_validate_clean(goal_path)


@pytest.mark.parametrize(
"grand_totals_position",
["pinnedBottom", "pinnedTop", "bottom", "top"],
)
def test_export_settings_grand_totals_position(grand_totals_position):
settings = ExportSettings(merge_headers=True, show_filters=False, grand_totals_position=grand_totals_position)
assert settings.grand_totals_position == grand_totals_position
api_settings = settings.to_api()
assert api_settings.grand_totals_position == grand_totals_position


def test_export_settings_grand_totals_position_defaults_to_none():
settings = ExportSettings(merge_headers=True, show_filters=False)
assert settings.grand_totals_position is None


@gd_vcr.use_cassette(str(_fixtures_dir / "test_export_csv.yaml"))
def test_export_csv(test_config):
_tabular_export_base(test_config, "CSV")
Expand Down
Loading