-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,9 @@ | |
Dashboard, | ||
DataSource, | ||
EndpointInfo, | ||
EndpointInfoWarehouseType, | ||
Query, | ||
State, | ||
Visualization, | ||
Widget, | ||
) | ||
|
@@ -36,8 +38,12 @@ def not_found(_): | |
ws.current_user.me = lambda: iam.User(user_name="[email protected]", groups=[iam.ComplexValue(display="admins")]) | ||
ws.config.host = "https://foo" | ||
ws.workspace.get_status = not_found | ||
ws.warehouses.list = lambda **_: [ | ||
EndpointInfo(id="abc", warehouse_type=EndpointInfoWarehouseType.PRO, state=State.RUNNING) | ||
] | ||
|
||
install = Installer(ws) | ||
install._choice = lambda _1, _2: "None (abc, PRO, RUNNING)" | ||
install._configure() | ||
|
||
ws.workspace.upload.assert_called_with( | ||
|
@@ -52,6 +58,7 @@ def not_found(_): | |
tacl: | ||
auto: true | ||
version: 1 | ||
warehouse_id: abc | ||
workspace_start_path: / | ||
""", | ||
format=ImportFormat.AUTO, | ||
|
@@ -89,9 +96,13 @@ def mock_question(text: str, *, default: str | None = None) -> str: | |
ws.current_user.me = lambda: iam.User(user_name="[email protected]", groups=[iam.ComplexValue(display="admins")]) | ||
ws.config.host = "https://foo" | ||
ws.workspace.get_status = not_found | ||
ws.warehouses.list = lambda **_: [ | ||
EndpointInfo(id="abc", warehouse_type=EndpointInfoWarehouseType.PRO, state=State.RUNNING) | ||
] | ||
|
||
install = Installer(ws) | ||
install._question = mock_question | ||
install._choice = lambda _1, _2: "None (abc, PRO, RUNNING)" | ||
install._configure() | ||
|
||
ws.workspace.upload.assert_called_with( | ||
|
@@ -105,6 +116,7 @@ def mock_question(text: str, *, default: str | None = None) -> str: | |
tacl: | ||
auto: true | ||
version: 1 | ||
warehouse_id: abc | ||
workspace_start_path: / | ||
""", | ||
format=ImportFormat.AUTO, | ||
|
@@ -126,9 +138,13 @@ def mock_question(text: str, *, default: str | None = None) -> str: | |
ws.current_user.me = lambda: iam.User(user_name="[email protected]", groups=[iam.ComplexValue(display="admins")]) | ||
ws.config.host = "https://foo" | ||
ws.workspace.get_status = not_found | ||
ws.warehouses.list = lambda **_: [ | ||
EndpointInfo(id="abc", warehouse_type=EndpointInfoWarehouseType.PRO, state=State.RUNNING) | ||
] | ||
|
||
install = Installer(ws) | ||
install._question = mock_question | ||
install._choice = lambda _1, _2: "None (abc, PRO, RUNNING)" | ||
install._configure() | ||
|
||
ws.workspace.upload.assert_called_with( | ||
|
@@ -145,6 +161,7 @@ def mock_question(text: str, *, default: str | None = None) -> str: | |
tacl: | ||
auto: true | ||
version: 1 | ||
warehouse_id: abc | ||
workspace_start_path: / | ||
""", | ||
format=ImportFormat.AUTO, | ||
|
@@ -165,7 +182,7 @@ def test_main_with_existing_conf_does_not_recreate_config(mocker): | |
ws.workspace.download = lambda _: io.BytesIO(config_bytes) | ||
ws.workspace.get_status = lambda _: ObjectInfo(object_id=123) | ||
ws.data_sources.list = lambda: [DataSource(id="bcd", warehouse_id="abc")] | ||
ws.warehouses.list = lambda **_: [EndpointInfo(id="abc")] | ||
ws.warehouses.list = lambda **_: [EndpointInfo(id="abc", warehouse_type=EndpointInfoWarehouseType.PRO)] | ||
ws.dashboards.create.return_value = Dashboard(id="abc") | ||
ws.queries.create.return_value = Query(id="abc") | ||
ws.query_visualizations.create.return_value = Visualization(id="abc") | ||
|