diff --git a/tests/unit/test_dashboards.py b/tests/unit/test_dashboards.py index 7363578a..5197e7f8 100644 --- a/tests/unit/test_dashboards.py +++ b/tests/unit/test_dashboards.py @@ -10,6 +10,7 @@ DashboardMetadata, Dashboards, WidgetMetadata, + QueryTile, Tile, ) from databricks.labs.lsql.lakeview import ( @@ -298,16 +299,10 @@ def test_dashboards_does_not_create_widget_for_yml_file(tmp_path, caplog): ("SELECT from_unixtime(timestamp) AS timestamp FROM table", ["timestamp"]), ], ) -def test_dashboards_gets_fields_with_expected_names(tmp_path, query, names): - with (tmp_path / "query.sql").open("w") as f: - f.write(query) - - ws = create_autospec(WorkspaceClient) - lakeview_dashboard = Dashboards(ws).create_dashboard(tmp_path) - - fields = lakeview_dashboard.pages[0].layout[0].widget.queries[0].query.fields +def test_query_tile_finds_fields(query, names): + tile = QueryTile("test", "test") + fields = tile.find_fields(query) assert [field.name for field in fields] == names - ws.assert_not_called() def test_dashboards_creates_dashboard_with_expected_counter_field_encoding_names(tmp_path):