mirror of
https://github.com/apache/superset.git
synced 2026-04-19 08:04:53 +00:00
feat(report): capture dashboard reports in specific states (#20552)
This commit is contained in:
@@ -20,16 +20,16 @@ import pytest
|
||||
|
||||
from superset import db
|
||||
from superset.models.dashboard import Dashboard
|
||||
from tests.integration_tests.dashboard_utils import create_dashboard
|
||||
from tests.integration_tests.test_app import app
|
||||
from superset.utils.core import shortid
|
||||
from tests.integration_tests.dashboards.superset_factory_util import create_dashboard
|
||||
|
||||
|
||||
@pytest.fixture(scope="session")
|
||||
def tabbed_dashboard():
|
||||
@pytest.fixture
|
||||
def tabbed_dashboard(app_context):
|
||||
position_json = {
|
||||
"DASHBOARD_VERSION_KEY": "v2",
|
||||
"GRID_ID": {
|
||||
"children": ["TABS-IpViLohnyP"],
|
||||
"children": ["TABS-L1A", "TABS-L1B"],
|
||||
"id": "GRID_ID",
|
||||
"parents": ["ROOT_ID"],
|
||||
"type": "GRID",
|
||||
@@ -40,38 +40,102 @@ def tabbed_dashboard():
|
||||
"type": "HEADER",
|
||||
},
|
||||
"ROOT_ID": {"children": ["GRID_ID"], "id": "ROOT_ID", "type": "ROOT"},
|
||||
"TAB-j53G4gtKGF": {
|
||||
"TAB-L1AA": {
|
||||
"children": [],
|
||||
"id": "TAB-j53G4gtKGF",
|
||||
"id": "TAB-L1AA",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab 1",
|
||||
"text": "Tab L1AA",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-IpViLohnyP"],
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L1A"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TAB-nerWR09Ju": {
|
||||
"TAB-L1AB": {
|
||||
"children": [],
|
||||
"id": "TAB-nerWR09Ju",
|
||||
"id": "TAB-L1AB",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab L1AB",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L1A"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TABS-L1A": {
|
||||
"children": ["TAB-L1AA", "TAB-L1AB"],
|
||||
"id": "TABS-L1A",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID", "GRID_ID"],
|
||||
"type": "TABS",
|
||||
},
|
||||
"TAB-L1BA": {
|
||||
"children": [],
|
||||
"id": "TAB-L1BA",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab L1B",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L1B"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TAB-L1BB": {
|
||||
"children": ["TABS-L2A"],
|
||||
"id": "TAB-L1BB",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab 2",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-IpViLohnyP"],
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L1B"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TABS-IpViLohnyP": {
|
||||
"children": ["TAB-j53G4gtKGF", "TAB-nerWR09Ju"],
|
||||
"id": "TABS-IpViLohnyP",
|
||||
"TABS-L1B": {
|
||||
"children": ["TAB-L1BA", "TAB-L1BB"],
|
||||
"id": "TABS-L1B",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID", "GRID_ID"],
|
||||
"type": "TABS",
|
||||
},
|
||||
"TAB-L2AA": {
|
||||
"children": [],
|
||||
"id": "TAB-L2AA",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab L2AA",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L2A"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TAB-L2AB": {
|
||||
"children": [],
|
||||
"id": "TAB-L2AB",
|
||||
"meta": {
|
||||
"defaultText": "Tab title",
|
||||
"placeholder": "Tab title",
|
||||
"text": "Tab L2AB",
|
||||
},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L2A"],
|
||||
"type": "TAB",
|
||||
},
|
||||
"TABS-L2A": {
|
||||
"children": ["TAB-L2AA", "TAB-L2AB"],
|
||||
"id": "TABS-L2A",
|
||||
"meta": {},
|
||||
"parents": ["ROOT_ID", "GRID_ID", "TABS-L1BB"],
|
||||
"type": "TABS",
|
||||
},
|
||||
}
|
||||
with app.app_context():
|
||||
dash = create_dashboard(
|
||||
"tabbed-dash-test", "Tabbed Dash Test", json.dumps(position_json), []
|
||||
)
|
||||
dash = create_dashboard(
|
||||
slug=f"tabbed-dash-{shortid()}",
|
||||
dashboard_title="Test tabbed dash",
|
||||
position_json=json.dumps(position_json),
|
||||
slices=[],
|
||||
)
|
||||
db.session.add(dash)
|
||||
db.session.commit()
|
||||
yield dash
|
||||
db.session.query(Dashboard).filter_by(id=dash.id).delete()
|
||||
db.session.commit()
|
||||
|
||||
Reference in New Issue
Block a user