@@ -39,15 +39,6 @@ def mock_credential() -> Mock:
39
39
yield Mock ()
40
40
41
41
42
- def mock_urlparse (url : str ) -> urllib .parse .ParseResult :
43
- return urllib .parse .ParseResult (
44
- scheme = "http" , netloc = "example.com" , path = "/index.html" , params = "" , query = "a=1&b=2" , fragment = ""
45
- )
46
-
47
-
48
- urllib .parse .urlparse = mock_urlparse
49
-
50
-
51
42
@pytest .fixture
52
43
def mock_workspace_operation_base (
53
44
mock_workspace_scope : OperationScope ,
@@ -188,6 +179,8 @@ def test_create_get_exception_swallow(
188
179
def test_begin_create_existing_ws (
189
180
self , mock_workspace_operation_base : WorkspaceOperationsBase , mocker : MockFixture
190
181
):
182
+ mocker .patch ("urllib.parse.urlparse" )
183
+
191
184
def outgoing_call (rg , name , params , polling , cls ):
192
185
assert name == "name"
193
186
return DEFAULT
@@ -197,7 +190,8 @@ def outgoing_call(rg, name, params, polling, cls):
197
190
mock_workspace_operation_base .begin_create (workspace = Workspace (name = "name" ))
198
191
mock_workspace_operation_base ._operation .begin_update .assert_called ()
199
192
200
- def test_update (self , mock_workspace_operation_base : WorkspaceOperationsBase ) -> None :
193
+ def test_update (self , mock_workspace_operation_base : WorkspaceOperationsBase , mocker : MockFixture ) -> None :
194
+ mocker .patch ("urllib.parse.urlparse" )
201
195
ws = Workspace (
202
196
name = "name" ,
203
197
tags = {"key" : "value" },
@@ -254,6 +248,7 @@ def outgoing_call(rg, name, params, polling, cls):
254
248
def test_update_with_empty_property_values (
255
249
self , mock_workspace_operation_base : WorkspaceOperationsBase , mocker : MockFixture
256
250
) -> None :
251
+ mocker .patch ("urllib.parse.urlparse" )
257
252
ws = Workspace (name = "name" , description = "" , display_name = "" , image_build_compute = "" )
258
253
mocker .patch ("azure.ai.ml.operations.WorkspaceOperations.get" , return_value = ws )
259
254
@@ -277,6 +272,7 @@ def outgoing_call(rg, name, params, polling, cls):
277
272
mock_workspace_operation_base ._operation .begin_update .assert_called ()
278
273
279
274
def test_delete_no_wait (self , mock_workspace_operation_base : WorkspaceOperationsBase , mocker : MockFixture ) -> None :
275
+ mocker .patch ("urllib.parse.urlparse" )
280
276
mocker .patch ("azure.ai.ml.operations._workspace_operations_base.delete_resource_by_arm_id" , return_value = None )
281
277
mocker .patch (
282
278
"azure.ai.ml.operations._workspace_operations_base.get_generic_arm_resource_by_arm_id" , return_value = None
@@ -285,6 +281,7 @@ def test_delete_no_wait(self, mock_workspace_operation_base: WorkspaceOperations
285
281
mock_workspace_operation_base ._operation .begin_delete .assert_called_once ()
286
282
287
283
def test_delete_wait (self , mock_workspace_operation_base : WorkspaceOperationsBase , mocker : MockFixture ) -> None :
284
+ mocker .patch ("urllib.parse.urlparse" )
288
285
mocker .patch ("azure.ai.ml.operations._workspace_operations_base.delete_resource_by_arm_id" , return_value = None )
289
286
mocker .patch (
290
287
"azure.ai.ml.operations._workspace_operations_base.get_generic_arm_resource_by_arm_id" , return_value = None
@@ -610,6 +607,7 @@ def test_update_workspace_with_serverless_custom_vnet(
610
607
mock_workspace_operation_base : WorkspaceOperationsBase ,
611
608
mocker : MockFixture ,
612
609
) -> None :
610
+ mocker .patch ("urllib.parse.urlparse" )
613
611
ws = Workspace (name = "name" , location = "test" , serverless_compute = serverless_compute_settings )
614
612
spy = mocker .spy (mock_workspace_operation_base ._operation , "begin_update" )
615
613
mock_workspace_operation_base .begin_update (ws )
0 commit comments