16
16
17
17
def prepare_test (ws , backend : MockBackend | None = None ) -> CatalogSchema :
18
18
ws .catalogs .list .return_value = [CatalogInfo (name = "catalog1" )]
19
+
19
20
def get_catalog (catalog_name : str ) -> CatalogInfo | None :
20
21
if catalog_name == "catalog1" :
21
22
return CatalogInfo (name = "catalog1" )
22
23
return None
24
+
23
25
ws .catalogs .get .side_effect = get_catalog
24
26
25
27
def raise_catalog_exists (catalog : str , * _ , ** __ ) -> None :
@@ -155,7 +157,15 @@ def raise_catalog_exists(catalog: str, *_, **__) -> None:
155
157
assert "Skipping already existing catalog: ucx" in caplog .text
156
158
157
159
158
- @pytest .mark .parametrize ("location" , ["s3://foo/bar" , "s3://foo/bar/test" , "s3://foo/bar/test/baz" , "abfss://container@storageaccount.dfs.core.windows.net" ])
160
+ @pytest .mark .parametrize (
161
+ "location" ,
162
+ [
163
+ "s3://foo/bar" ,
164
+ "s3://foo/bar/test" ,
165
+ "s3://foo/bar/test/baz" ,
166
+ "abfss://container@storageaccount.dfs.core.windows.net" ,
167
+ ],
168
+ )
159
169
def test_create_all_catalogs_schemas_creates_catalogs (location : str ) -> None :
160
170
"""Catalog 2-4 should be created; catalog 1 already exists."""
161
171
ws = create_autospec (WorkspaceClient )
@@ -175,11 +185,13 @@ def test_create_all_catalogs_schemas_creates_catalogs(location: str) -> None:
175
185
def test_create_all_catalogs_schemas_creates_catalogs_with_different_locations () -> None :
176
186
"""Catalog 2-4 should be created; catalog 1 already exists."""
177
187
ws = create_autospec (WorkspaceClient )
178
- mock_prompts = MockPrompts ({
179
- "Please provide storage location url for catalog: catalog2" : "s3://foo/bar" ,
180
- "Please provide storage location url for catalog: catalog3" : "s3://foo/bar/test" ,
181
- "Please provide storage location url for catalog: catalog4" : "s3://foo/bar/test/baz" ,
182
- })
188
+ mock_prompts = MockPrompts (
189
+ {
190
+ "Please provide storage location url for catalog: catalog2" : "s3://foo/bar" ,
191
+ "Please provide storage location url for catalog: catalog3" : "s3://foo/bar/test" ,
192
+ "Please provide storage location url for catalog: catalog4" : "s3://foo/bar/test/baz" ,
193
+ }
194
+ )
183
195
184
196
catalog_schema = prepare_test (ws )
185
197
catalog_schema .create_all_catalogs_schemas (mock_prompts )
0 commit comments