Skip to content

Commit b65ee3f

Browse files
authored
Merge pull request #1451 from gooddata/feature/auto-P033-grand-total-position-export-settings
feat(gooddata-sdk): [AUTO] add grand_totals_position to ExportSettings
2 parents 8501160 + 516813a commit b65ee3f

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed

packages/gooddata-sdk/src/gooddata_sdk/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
ExportCustomOverride,
7777
ExportRequest,
7878
ExportSettings,
79+
GrandTotalsPosition,
7980
SlidesExportRequest,
8081
VisualExportRequest,
8182
)

packages/gooddata-sdk/src/gooddata_sdk/catalog/export/request.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# (C) 2023 GoodData Corporation
2+
from __future__ import annotations
3+
24
from typing import Literal
35

46
from attrs import define
@@ -12,6 +14,8 @@
1214

1315
from gooddata_sdk.catalog.base import Base
1416

17+
GrandTotalsPosition = Literal["pinnedBottom", "pinnedTop", "bottom", "top"]
18+
1519

1620
@define(kw_only=True)
1721
class ExportCustomLabel(Base):
@@ -46,6 +50,7 @@ def client_class() -> type[ApiCustomOverride]:
4650
class ExportSettings(Base):
4751
merge_headers: bool
4852
show_filters: bool
53+
grand_totals_position: GrandTotalsPosition | None = None
4954

5055
@staticmethod
5156
def client_class() -> type[ApiSettings]:

packages/gooddata-sdk/tests/export/test_export_service.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
import os
77
from pathlib import Path
88

9+
import pytest
10+
911
from gooddata_sdk import (
1012
Attribute,
1113
ExecutionDefinition,
1214
ExportCustomLabel,
1315
ExportCustomMetric,
1416
ExportCustomOverride,
1517
ExportRequest,
18+
ExportSettings,
1619
GoodDataSdk,
1720
ObjId,
1821
SimpleMetric,
@@ -89,6 +92,22 @@ def _tabular_by_visualization_id_base(test_config, export_format: str):
8992
_validate_clean(goal_path)
9093

9194

95+
@pytest.mark.parametrize(
96+
"grand_totals_position",
97+
["pinnedBottom", "pinnedTop", "bottom", "top"],
98+
)
99+
def test_export_settings_grand_totals_position(grand_totals_position):
100+
settings = ExportSettings(merge_headers=True, show_filters=False, grand_totals_position=grand_totals_position)
101+
assert settings.grand_totals_position == grand_totals_position
102+
api_settings = settings.to_api()
103+
assert api_settings.grand_totals_position == grand_totals_position
104+
105+
106+
def test_export_settings_grand_totals_position_defaults_to_none():
107+
settings = ExportSettings(merge_headers=True, show_filters=False)
108+
assert settings.grand_totals_position is None
109+
110+
92111
@gd_vcr.use_cassette(str(_fixtures_dir / "test_export_csv.yaml"))
93112
def test_export_csv(test_config):
94113
_tabular_export_base(test_config, "CSV")

0 commit comments

Comments
 (0)