Skip to content

Commit 44245bf

Browse files
committed
Separate the parameterized tests
1 parent af6fc73 commit 44245bf

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

tests/unit/install/test_install_dashboards.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,24 @@ def test_installation_recreates_trashed_lakeview_dashboard(caplog, ws, workspace
129129
[MockInstallation({'state.json': {'resources': {'dashboards': {"assessment_main": "lakeview_id"}}}})],
130130
indirect=True,
131131
)
132-
@pytest.mark.parametrize("exception", [InvalidParameterValue, NotFound])
133-
def test_installation_recovers_invalid_dashboard(caplog, ws, workspace_installation, exception):
134-
ws.lakeview.get.side_effect = exception
132+
def test_installation_recovers_invalid_dashboard_invalidparametervalue(caplog, ws, workspace_installation):
133+
ws.lakeview.get.side_effect = InvalidParameterValue
134+
with caplog.at_level(logging.DEBUG, logger="databricks.labs.ucx.install"):
135+
workspace_installation.run()
136+
assert "Recovering invalid dashboard" in caplog.text
137+
assert "Deleted dangling dashboard" in caplog.text
138+
ws.workspace.delete.assert_called()
139+
ws.lakeview.create.assert_called()
140+
ws.lakeview.update.assert_not_called()
141+
142+
143+
@pytest.mark.parametrize(
144+
"workspace_installation",
145+
[MockInstallation({'state.json': {'resources': {'dashboards': {"assessment_main": "lakeview_id"}}}})],
146+
indirect=True,
147+
)
148+
def test_installation_recovers_invalid_dashboard_notfound(caplog, ws, workspace_installation):
149+
ws.lakeview.get.side_effect = NotFound
135150
with caplog.at_level(logging.DEBUG, logger="databricks.labs.ucx.install"):
136151
workspace_installation.run()
137152
assert "Recovering invalid dashboard" in caplog.text

0 commit comments

Comments
 (0)