mirror of
https://github.com/apache/superset.git
synced 2026-04-19 16:14:52 +00:00
tests: added fixture with energy usage instead of example (#11308)
* Added energy usage fixture. Updated dashboard utils and unicode fixture with new method parameters. * Add energy fixture to tests/access_tests.py * Add energy fixture to tests/core_tests.py * Add energy fixture to tests/dashboard_tests.py * Add energy fixture to tests/datasets/api_tests.py * Add energy fixture to tests/db_engine_specs/base_engine_spec_tests.py * Add energy fixture to tests/import_export_tests.py * Add energy fixture to tests/model_tests.py * Add energy fixture to tests/query_context_tests.py * Add energy fixture to tests/security_tests.py * Add energy fixture to tests/charts/api_tests.py * Changed formatting of slices' parameters in energy usage fixture * Removed loading energy udage data from test conf file * Add energy fixture to tests/databases/api_tests.py * Fixes after review: removed isort:skip, load_charts->load_energy_charts, removed unused import. * Added energy fixture to tests/charts/commands_tests.py and retrieving proper Slice by name * Fixed charts/api_tests.py to use energy_usage from fixtures * Fixed datasets/commands_tests.py to retrieve dataset by name and use energy_usage fixture * Changed energy usage data to generated data and fixed chart tests which was checking energy usage data
This commit is contained in:
@@ -32,6 +32,7 @@ from superset.connectors.sqla.models import SqlaTable
|
||||
from superset.models import core as models
|
||||
from superset.models.dashboard import Dashboard
|
||||
from superset.models.slice import Slice
|
||||
from tests.fixtures.energy_dashboard import load_energy_table_with_slice
|
||||
|
||||
from .base_tests import SupersetTestCase
|
||||
|
||||
@@ -302,6 +303,7 @@ class TestDashboard(SupersetTestCase):
|
||||
if key not in ["modified", "changed_on", "changed_on_humanized"]:
|
||||
self.assertEqual(slc[key], resp["slices"][index][key])
|
||||
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice")
|
||||
def test_add_slices(self, username="admin"):
|
||||
self.login(username=username)
|
||||
dash = db.session.query(Dashboard).filter_by(slug="births").first()
|
||||
@@ -453,7 +455,7 @@ class TestDashboard(SupersetTestCase):
|
||||
resp = self.get_resp("/api/v1/dashboard/")
|
||||
self.assertNotIn("/superset/dashboard/empty_dashboard/", resp)
|
||||
|
||||
@pytest.mark.usefixtures("load_dashboard")
|
||||
@pytest.mark.usefixtures("load_energy_table_with_slice", "load_dashboard")
|
||||
def test_users_can_view_published_dashboard(self):
|
||||
resp = self.get_resp("/api/v1/dashboard/")
|
||||
self.assertNotIn(f"/superset/dashboard/{pytest.hidden_dash_slug}/", resp)
|
||||
|
||||
Reference in New Issue
Block a user