Skip to content

Commit

Permalink
refactor: consistent migration tests organization (apache#19635)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktmud authored and philipher29 committed Jun 9, 2022
1 parent 1813e71 commit 7eb1bd9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@
upgrade_slice,
)

from .base_tests import SupersetTestCase

def test_upgrade_slice():
slc = Slice(
slice_name="FOO",
viz_type="filter_box",
params=json.dumps(dict(metric="foo", groupby=["bar"])),
)
upgrade_slice(slc)
params = json.loads(slc.params)
assert "metric" not in params
assert "filter_configs" in params

class TestMigration(SupersetTestCase):
def test_upgrade_slice(self):
slc = Slice(
slice_name="FOO",
viz_type="filter_box",
params=json.dumps(dict(metric="foo", groupby=["bar"])),
)
upgrade_slice(slc)
params = json.loads(slc.params)
self.assertNotIn("metric", params)
self.assertIn("filter_configs", params)

cfg = params["filter_configs"][0]
self.assertEqual(cfg.get("metric"), "foo")
cfg = params["filter_configs"][0]
assert cfg.get("metric") == "foo"

0 comments on commit 7eb1bd9

Please sign in to comment.