mirror of
https://github.com/apache/superset.git
synced 2026-05-12 19:35:17 +00:00
test: World bank examples (#12161)
* add world bank data fixture * fix fixture cleanup, add fixture to dashboard_tests * apply world bank fixtures, fix tests * fix fixture typo, dashboard ids * fix export dashboard metadata * fix test_export_dashboard_command_key_order * fix export dash tests, not add row when no orphans * debug timeout * fixes after merge * fix lint * run pre-commit * comment test for debug * fix save.test.js Co-authored-by: Karol Kostrzewa <karol.kostrzewa@polidea.com>
This commit is contained in:
committed by
Ville Brofeldt
parent
0acd2ccaaa
commit
bc53be95a5
@@ -17,7 +17,7 @@
|
||||
"""Utils to provide dashboards for tests"""
|
||||
|
||||
import json
|
||||
from typing import Any, Dict
|
||||
from typing import Any, Dict, List
|
||||
|
||||
from pandas import DataFrame
|
||||
|
||||
@@ -71,7 +71,9 @@ def create_slice(
|
||||
)
|
||||
|
||||
|
||||
def create_dashboard(slug: str, title: str, position: str, slice: Slice) -> Dashboard:
|
||||
def create_dashboard(
|
||||
slug: str, title: str, position: str, slices: List[Slice]
|
||||
) -> Dashboard:
|
||||
dash = db.session.query(Dashboard).filter_by(slug=slug).one_or_none()
|
||||
|
||||
if not dash:
|
||||
@@ -82,8 +84,8 @@ def create_dashboard(slug: str, title: str, position: str, slice: Slice) -> Dash
|
||||
pos = json.loads(js)
|
||||
dash.position_json = json.dumps(pos, indent=4)
|
||||
dash.slug = slug
|
||||
if slice is not None:
|
||||
dash.slices = [slice]
|
||||
if slices is not None:
|
||||
dash.slices = slices
|
||||
db.session.merge(dash)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user