chore(dao): Organize DAOs according to SIP-92 (#24331)

Co-authored-by: JUST.in DO IT <justin.park@airbnb.com>
This commit is contained in:
John Bodley
2023-06-18 18:32:32 -07:00
committed by GitHub
parent 1bc7d63cab
commit 3e76736874
149 changed files with 426 additions and 554 deletions

View File

@@ -19,7 +19,7 @@ import pytest
import tests.integration_tests.test_app # pylint: disable=unused-import
from superset import db
from superset.embedded.dao import EmbeddedDAO
from superset.daos.dashboard import EmbeddedDashboardDAO
from superset.models.dashboard import Dashboard
from tests.integration_tests.base_tests import SupersetTestCase
from tests.integration_tests.fixtures.world_bank_dashboard import (
@@ -28,24 +28,24 @@ from tests.integration_tests.fixtures.world_bank_dashboard import (
)
class TestEmbeddedDAO(SupersetTestCase):
class TestEmbeddedDashboardDAO(SupersetTestCase):
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_upsert(self):
dash = db.session.query(Dashboard).filter_by(slug="world_health").first()
assert not dash.embedded
EmbeddedDAO.upsert(dash, ["test.example.com"])
EmbeddedDashboardDAO.upsert(dash, ["test.example.com"])
assert dash.embedded
self.assertEqual(dash.embedded[0].allowed_domains, ["test.example.com"])
original_uuid = dash.embedded[0].uuid
self.assertIsNotNone(original_uuid)
EmbeddedDAO.upsert(dash, [])
EmbeddedDashboardDAO.upsert(dash, [])
self.assertEqual(dash.embedded[0].allowed_domains, [])
self.assertEqual(dash.embedded[0].uuid, original_uuid)
@pytest.mark.usefixtures("load_world_bank_dashboard_with_slices")
def test_get_by_uuid(self):
dash = db.session.query(Dashboard).filter_by(slug="world_health").first()
uuid = str(EmbeddedDAO.upsert(dash, ["test.example.com"]).uuid)
uuid = str(EmbeddedDashboardDAO.upsert(dash, ["test.example.com"]).uuid)
db.session.expire_all()
embedded = EmbeddedDAO.find_by_id(uuid)
embedded = EmbeddedDashboardDAO.find_by_id(uuid)
self.assertIsNotNone(embedded)