@typespec/http-client-python 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. package/dist/emitter/code-model.d.ts.map +1 -1
  2. package/dist/emitter/code-model.js +15 -3
  3. package/dist/emitter/code-model.js.map +1 -1
  4. package/dist/emitter/http.d.ts.map +1 -1
  5. package/dist/emitter/http.js +14 -2
  6. package/dist/emitter/http.js.map +1 -1
  7. package/emitter/src/code-model.ts +15 -2
  8. package/emitter/src/http.ts +22 -2
  9. package/emitter/temp/tsconfig.tsbuildinfo +1 -1
  10. package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
  11. package/generator/dev_requirements.txt +1 -1
  12. package/generator/pygen/codegen/serializers/operations_init_serializer.py +1 -1
  13. package/generator/pygen/codegen/templates/init.py.jinja2 +1 -1
  14. package/generator/pygen/codegen/templates/model_init.py.jinja2 +6 -2
  15. package/generator/test/azure/mock_api_tests/asynctests/{test_azure_arm_models_common_types_managed_identity_async.py → test_azure_arm_commonproperties_async.py} +9 -9
  16. package/generator/test/azure/mock_api_tests/asynctests/{test_azure_arm_models_resource_async.py → test_azure_arm_resource_async.py} +46 -46
  17. package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +20 -20
  18. package/generator/test/azure/mock_api_tests/{test_azure_arm_models_common_types_managed_identity.py → test_azure_arm_commonproperties.py} +9 -9
  19. package/generator/test/azure/mock_api_tests/{test_azure_arm_models_resource.py → test_azure_arm_resource.py} +46 -46
  20. package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +20 -20
  21. package/generator/test/azure/requirements.txt +2 -2
  22. package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +6 -6
  23. package/generator/test/generic_mock_api_tests/test_authentication.py +6 -6
  24. package/package.json +5 -5
@@ -4,8 +4,8 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  import pytest
7
- from azure.resourcemanager.models.resources.aio import ResourcesClient
8
- from azure.resourcemanager.models.resources import models
7
+ from azure.resourcemanager.resources.aio import ResourcesClient
8
+ from azure.resourcemanager.resources import models
9
9
 
10
10
  SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
11
11
  RESOURCE_GROUP_NAME = "test-rg"
@@ -34,17 +34,17 @@ async def test_client_signature(credential, authentication_policy):
34
34
  )
35
35
  for client in [client1, client2]:
36
36
  # make sure signautre order is correct
37
- await client.top_level_tracked_resources.get(RESOURCE_GROUP_NAME, "top")
37
+ await client.top_level.get(RESOURCE_GROUP_NAME, "top")
38
38
  # make sure signautre name is correct
39
- await client.top_level_tracked_resources.get(
39
+ await client.top_level.get(
40
40
  resource_group_name=RESOURCE_GROUP_NAME, top_level_tracked_resource_name="top"
41
41
  )
42
42
 
43
43
 
44
44
  @pytest.mark.asyncio
45
- async def test_top_level_tracked_resources_begin_create_or_replace(client):
45
+ async def test_top_level_begin_create_or_replace(client):
46
46
  result = await (
47
- await client.top_level_tracked_resources.begin_create_or_replace(
47
+ await client.top_level.begin_create_or_replace(
48
48
  resource_group_name=RESOURCE_GROUP_NAME,
49
49
  top_level_tracked_resource_name="top",
50
50
  resource=models.TopLevelTrackedResource(
@@ -60,14 +60,14 @@ async def test_top_level_tracked_resources_begin_create_or_replace(client):
60
60
  assert result.properties.description == "valid"
61
61
  assert result.properties.provisioning_state == "Succeeded"
62
62
  assert result.name == "top"
63
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
63
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
64
64
  assert result.system_data.created_by == "AzureSDK"
65
65
 
66
66
 
67
67
  @pytest.mark.asyncio
68
- async def test_top_level_tracked_resources_begin_update(client):
68
+ async def test_top_level_begin_update(client):
69
69
  result = await (
70
- await client.top_level_tracked_resources.begin_update(
70
+ await client.top_level.begin_update(
71
71
  resource_group_name=RESOURCE_GROUP_NAME,
72
72
  top_level_tracked_resource_name="top",
73
73
  properties=models.TopLevelTrackedResource(
@@ -83,14 +83,14 @@ async def test_top_level_tracked_resources_begin_update(client):
83
83
  assert result.properties.description == "valid2"
84
84
  assert result.properties.provisioning_state == "Succeeded"
85
85
  assert result.name == "top"
86
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
86
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
87
87
  assert result.system_data.created_by == "AzureSDK"
88
88
 
89
89
 
90
90
  @pytest.mark.asyncio
91
- async def test_top_level_tracked_resources_begin_delete(client):
91
+ async def test_top_level_begin_delete(client):
92
92
  await (
93
- await client.top_level_tracked_resources.begin_delete(
93
+ await client.top_level.begin_delete(
94
94
  resource_group_name=RESOURCE_GROUP_NAME,
95
95
  top_level_tracked_resource_name="top",
96
96
  polling_interval=0, # set polling_interval to 0 s to make the test faster since default is 30s
@@ -99,8 +99,8 @@ async def test_top_level_tracked_resources_begin_delete(client):
99
99
 
100
100
 
101
101
  @pytest.mark.asyncio
102
- async def test_top_level_tracked_resources_list_by_resource_group(client):
103
- response = client.top_level_tracked_resources.list_by_resource_group(
102
+ async def test_top_level_list_by_resource_group(client):
103
+ response = client.top_level.list_by_resource_group(
104
104
  resource_group_name=RESOURCE_GROUP_NAME,
105
105
  )
106
106
  result = [r async for r in response]
@@ -109,26 +109,26 @@ async def test_top_level_tracked_resources_list_by_resource_group(client):
109
109
  assert result.properties.description == "valid"
110
110
  assert result.properties.provisioning_state == "Succeeded"
111
111
  assert result.name == "top"
112
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
112
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
113
113
  assert result.system_data.created_by == "AzureSDK"
114
114
 
115
115
 
116
116
  @pytest.mark.asyncio
117
- async def test_top_level_tracked_resources_list_by_subscription(client):
118
- response = client.top_level_tracked_resources.list_by_subscription()
117
+ async def test_top_level_list_by_subscription(client):
118
+ response = client.top_level.list_by_subscription()
119
119
  result = [r async for r in response]
120
120
  for result in result:
121
121
  assert result.location == "eastus"
122
122
  assert result.properties.description == "valid"
123
123
  assert result.properties.provisioning_state == "Succeeded"
124
124
  assert result.name == "top"
125
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
125
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
126
126
  assert result.system_data.created_by == "AzureSDK"
127
127
 
128
128
 
129
129
  @pytest.mark.asyncio
130
- async def test_nested_proxy_resources_get(client):
131
- result = await client.nested_proxy_resources.get(
130
+ async def test_nested_get(client):
131
+ result = await client.nested.get(
132
132
  resource_group_name=RESOURCE_GROUP_NAME,
133
133
  top_level_tracked_resource_name="top",
134
134
  nexted_proxy_resource_name="nested",
@@ -136,14 +136,14 @@ async def test_nested_proxy_resources_get(client):
136
136
  assert result.properties.description == "valid"
137
137
  assert result.properties.provisioning_state == "Succeeded"
138
138
  assert result.name == "nested"
139
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
139
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
140
140
  assert result.system_data.created_by == "AzureSDK"
141
141
 
142
142
 
143
143
  @pytest.mark.asyncio
144
- async def test_nested_proxy_resources_begin_create_or_replace(client):
144
+ async def test_nested_begin_create_or_replace(client):
145
145
  result = await (
146
- await client.nested_proxy_resources.begin_create_or_replace(
146
+ await client.nested.begin_create_or_replace(
147
147
  resource_group_name=RESOURCE_GROUP_NAME,
148
148
  top_level_tracked_resource_name="top",
149
149
  nexted_proxy_resource_name="nested",
@@ -158,14 +158,14 @@ async def test_nested_proxy_resources_begin_create_or_replace(client):
158
158
  assert result.properties.description == "valid"
159
159
  assert result.properties.provisioning_state == "Succeeded"
160
160
  assert result.name == "nested"
161
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
161
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
162
162
  assert result.system_data.created_by == "AzureSDK"
163
163
 
164
164
 
165
165
  @pytest.mark.asyncio
166
- async def test_nested_proxy_resources_begin_update(client):
166
+ async def test_nested_begin_update(client):
167
167
  result = await (
168
- await client.nested_proxy_resources.begin_update(
168
+ await client.nested.begin_update(
169
169
  resource_group_name=RESOURCE_GROUP_NAME,
170
170
  top_level_tracked_resource_name="top",
171
171
  nexted_proxy_resource_name="nested",
@@ -180,14 +180,14 @@ async def test_nested_proxy_resources_begin_update(client):
180
180
  assert result.properties.description == "valid2"
181
181
  assert result.properties.provisioning_state == "Succeeded"
182
182
  assert result.name == "nested"
183
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
183
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
184
184
  assert result.system_data.created_by == "AzureSDK"
185
185
 
186
186
 
187
187
  @pytest.mark.asyncio
188
- async def test_nested_proxy_resources_begin_delete(client):
188
+ async def test_nested_begin_delete(client):
189
189
  await (
190
- await client.nested_proxy_resources.begin_delete(
190
+ await client.nested.begin_delete(
191
191
  resource_group_name=RESOURCE_GROUP_NAME,
192
192
  top_level_tracked_resource_name="top",
193
193
  nexted_proxy_resource_name="nested",
@@ -197,8 +197,8 @@ async def test_nested_proxy_resources_begin_delete(client):
197
197
 
198
198
 
199
199
  @pytest.mark.asyncio
200
- async def test_nested_proxy_resources_list_by_top_level_tracked_resource(client):
201
- response = client.nested_proxy_resources.list_by_top_level_tracked_resource(
200
+ async def test_nested_list_by_top_level_tracked_resource(client):
201
+ response = client.nested.list_by_top_level_tracked_resource(
202
202
  resource_group_name=RESOURCE_GROUP_NAME,
203
203
  top_level_tracked_resource_name="top",
204
204
  )
@@ -207,13 +207,13 @@ async def test_nested_proxy_resources_list_by_top_level_tracked_resource(client)
207
207
  assert result.properties.description == "valid"
208
208
  assert result.properties.provisioning_state == "Succeeded"
209
209
  assert result.name == "nested"
210
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
210
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
211
211
  assert result.system_data.created_by == "AzureSDK"
212
212
 
213
213
 
214
214
  @pytest.mark.asyncio
215
- async def test_top_level_tracked_resources_action_sync(client):
216
- await client.top_level_tracked_resources.action_sync(
215
+ async def test_top_level_action_sync(client):
216
+ await client.top_level.action_sync(
217
217
  resource_group_name=RESOURCE_GROUP_NAME,
218
218
  top_level_tracked_resource_name="top",
219
219
  body={"message": "Resource action at top level.", "urgent": True},
@@ -221,21 +221,21 @@ async def test_top_level_tracked_resources_action_sync(client):
221
221
 
222
222
 
223
223
  @pytest.mark.asyncio
224
- async def test_singleton_tracked_resources_get_by_resource_group(client):
225
- result = await client.singleton_tracked_resources.get_by_resource_group(
224
+ async def test_singleton_get_by_resource_group(client):
225
+ result = await client.singleton.get_by_resource_group(
226
226
  resource_group_name=RESOURCE_GROUP_NAME,
227
227
  )
228
228
  assert result.properties.description == "valid"
229
229
  assert result.properties.provisioning_state == "Succeeded"
230
230
  assert result.name == "default"
231
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
231
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
232
232
  assert result.system_data.created_by == "AzureSDK"
233
233
 
234
234
 
235
235
  @pytest.mark.asyncio
236
- async def test_singleton_tracked_resources_begin_create_or_replace(client):
236
+ async def test_singleton_begin_create_or_replace(client):
237
237
  result = await (
238
- await client.singleton_tracked_resources.begin_create_or_update(
238
+ await client.singleton.begin_create_or_update(
239
239
  resource_group_name=RESOURCE_GROUP_NAME,
240
240
  resource=models.SingletonTrackedResource(
241
241
  location="eastus",
@@ -248,13 +248,13 @@ async def test_singleton_tracked_resources_begin_create_or_replace(client):
248
248
  assert result.properties.description == "valid"
249
249
  assert result.properties.provisioning_state == "Succeeded"
250
250
  assert result.name == "default"
251
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
251
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
252
252
  assert result.system_data.created_by == "AzureSDK"
253
253
 
254
254
 
255
255
  @pytest.mark.asyncio
256
- async def test_singleton_tracked_resources_update(client):
257
- result = await client.singleton_tracked_resources.update(
256
+ async def test_singleton_update(client):
257
+ result = await client.singleton.update(
258
258
  resource_group_name=RESOURCE_GROUP_NAME,
259
259
  properties=models.SingletonTrackedResource(
260
260
  location="eastus2",
@@ -266,13 +266,13 @@ async def test_singleton_tracked_resources_update(client):
266
266
  assert result.properties.description == "valid2"
267
267
  assert result.properties.provisioning_state == "Succeeded"
268
268
  assert result.name == "default"
269
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
269
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
270
270
  assert result.system_data.created_by == "AzureSDK"
271
271
 
272
272
 
273
273
  @pytest.mark.asyncio
274
- async def test_singleton_tracked_resources_list_by_resource_group(client):
275
- response = client.singleton_tracked_resources.list_by_resource_group(
274
+ async def test_singleton_list_by_resource_group(client):
275
+ response = client.singleton.list_by_resource_group(
276
276
  resource_group_name=RESOURCE_GROUP_NAME,
277
277
  )
278
278
  result = [r async for r in response]
@@ -280,5 +280,5 @@ async def test_singleton_tracked_resources_list_by_resource_group(client):
280
280
  assert result.properties.description == "valid"
281
281
  assert result.properties.provisioning_state == "Succeeded"
282
282
  assert result.name == "default"
283
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
283
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
284
284
  assert result.system_data.created_by == "AzureSDK"
@@ -16,67 +16,67 @@ async def client():
16
16
 
17
17
  @pytest.mark.asyncio
18
18
  async def test_no_decorator_in_public(client: AccessClient):
19
- result = await client.public_operation.no_decorator_in_public(name="test")
20
- assert result == models.NoDecoratorModelInPublic(name="test")
19
+ result = await client.public_operation.no_decorator_in_public(name="sample")
20
+ assert result == models.NoDecoratorModelInPublic(name="sample")
21
21
 
22
22
 
23
23
  @pytest.mark.asyncio
24
24
  async def test_public_decorator_in_public(client: AccessClient):
25
- result = await client.public_operation.public_decorator_in_public(name="test")
26
- assert result == models.PublicDecoratorModelInPublic(name="test")
25
+ result = await client.public_operation.public_decorator_in_public(name="sample")
26
+ assert result == models.PublicDecoratorModelInPublic(name="sample")
27
27
 
28
28
 
29
29
  @pytest.mark.asyncio
30
30
  async def test_no_decorator_in_internal(client: AccessClient):
31
- result = await client.internal_operation._no_decorator_in_internal(name="test")
32
- assert result == models._models.NoDecoratorModelInInternal(name="test")
31
+ result = await client.internal_operation._no_decorator_in_internal(name="sample")
32
+ assert result == models._models.NoDecoratorModelInInternal(name="sample")
33
33
 
34
34
  with pytest.raises(ImportError):
35
35
  from specs.azure.clientgenerator.core.access.models import NoDecoratorModelInInternal
36
36
 
37
37
  with pytest.raises(AttributeError):
38
- await client.internal_operation.no_decorator_in_internal(name="test")
38
+ await client.internal_operation.no_decorator_in_internal(name="sample")
39
39
 
40
40
 
41
41
  @pytest.mark.asyncio
42
42
  async def test_internal_decorator_in_internal(client: AccessClient):
43
- result = await client.internal_operation._internal_decorator_in_internal(name="test")
44
- assert result == models._models.InternalDecoratorModelInInternal(name="test")
43
+ result = await client.internal_operation._internal_decorator_in_internal(name="sample")
44
+ assert result == models._models.InternalDecoratorModelInInternal(name="sample")
45
45
 
46
46
  with pytest.raises(ImportError):
47
47
  from specs.azure.clientgenerator.core.access.models import InternalDecoratorModelInInternal
48
48
 
49
49
  with pytest.raises(AttributeError):
50
- await client.internal_operation.internal_decorator_in_internal(name="test")
50
+ await client.internal_operation.internal_decorator_in_internal(name="sample")
51
51
 
52
52
 
53
53
  @pytest.mark.asyncio
54
54
  async def test_public_decorator_in_internal(client: AccessClient):
55
- result = await client.internal_operation._public_decorator_in_internal(name="test")
56
- assert result == models.PublicDecoratorModelInInternal(name="test")
55
+ result = await client.internal_operation._public_decorator_in_internal(name="sample")
56
+ assert result == models.PublicDecoratorModelInInternal(name="sample")
57
57
 
58
58
  with pytest.raises(AttributeError):
59
- await client.internal_operation.public_decorator_in_internal(name="test")
59
+ await client.internal_operation.public_decorator_in_internal(name="sample")
60
60
 
61
61
 
62
62
  @pytest.mark.asyncio
63
63
  async def test_public(client: AccessClient):
64
- result = await client.shared_model_in_operation.public(name="test")
65
- assert result == models.SharedModel(name="test")
64
+ result = await client.shared_model_in_operation.public(name="sample")
65
+ assert result == models.SharedModel(name="sample")
66
66
 
67
67
 
68
68
  @pytest.mark.asyncio
69
69
  async def test_internal(client: AccessClient):
70
- result = await client.shared_model_in_operation._internal(name="test")
71
- assert result == models.SharedModel(name="test")
70
+ result = await client.shared_model_in_operation._internal(name="sample")
71
+ assert result == models.SharedModel(name="sample")
72
72
 
73
73
  with pytest.raises(AttributeError):
74
- await client.shared_model_in_operation.internal(name="test")
74
+ await client.shared_model_in_operation.internal(name="sample")
75
75
 
76
76
 
77
77
  @pytest.mark.asyncio
78
78
  async def test_operation(client: AccessClient):
79
- result = await client.relative_model_in_operation._operation(name="test")
79
+ result = await client.relative_model_in_operation._operation(name="Madge")
80
80
  assert result == models._models.OuterModel(name="Madge", inner=models._models.InnerModel(name="Madge"))
81
81
 
82
82
  with pytest.raises(ImportError):
@@ -86,7 +86,7 @@ async def test_operation(client: AccessClient):
86
86
  from specs.azure.clientgenerator.core.access.models import InnerModel
87
87
 
88
88
  with pytest.raises(AttributeError):
89
- await client.shared_model_in_operation.operation(name="test")
89
+ await client.shared_model_in_operation.operation(name="Madge")
90
90
 
91
91
 
92
92
  @pytest.mark.asyncio
@@ -4,8 +4,8 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  import pytest
7
- from azure.resourcemanager.models.commontypes.managedidentity import ManagedIdentityClient
8
- from azure.resourcemanager.models.commontypes.managedidentity import models
7
+ from azure.resourcemanager.commonproperties import CommonPropertiesClient
8
+ from azure.resourcemanager.commonproperties import models
9
9
 
10
10
  SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
11
11
  RESOURCE_GROUP_NAME = "test-rg"
@@ -13,14 +13,14 @@ RESOURCE_GROUP_NAME = "test-rg"
13
13
 
14
14
  @pytest.fixture
15
15
  def client(credential, authentication_policy):
16
- with ManagedIdentityClient(
16
+ with CommonPropertiesClient(
17
17
  credential, SUBSCRIPTION_ID, "http://localhost:3000", authentication_policy=authentication_policy
18
18
  ) as client:
19
19
  yield client
20
20
 
21
21
 
22
- def test_managed_identity_tracked_resources_get(client):
23
- result = client.managed_identity_tracked_resources.get(
22
+ def test_managed_identity_get(client):
23
+ result = client.managed_identity.get(
24
24
  resource_group_name=RESOURCE_GROUP_NAME, managed_identity_tracked_resource_name="identity"
25
25
  )
26
26
  assert result.location == "eastus"
@@ -28,8 +28,8 @@ def test_managed_identity_tracked_resources_get(client):
28
28
  assert result.properties.provisioning_state == "Succeeded"
29
29
 
30
30
 
31
- def test_managed_identity_tracked_resources_create_with_system_assigned(client):
32
- result = client.managed_identity_tracked_resources.create_with_system_assigned(
31
+ def test_managed_identity_create_with_system_assigned(client):
32
+ result = client.managed_identity.create_with_system_assigned(
33
33
  resource_group_name=RESOURCE_GROUP_NAME,
34
34
  managed_identity_tracked_resource_name="identity",
35
35
  resource=models.ManagedIdentityTrackedResource(
@@ -41,8 +41,8 @@ def test_managed_identity_tracked_resources_create_with_system_assigned(client):
41
41
  assert result.properties.provisioning_state == "Succeeded"
42
42
 
43
43
 
44
- def test_managed_identity_tracked_resources_update_with_user_assigned_and_system_assigned(client):
45
- result = client.managed_identity_tracked_resources.update_with_user_assigned_and_system_assigned(
44
+ def test_managed_identity_update_with_user_assigned_and_system_assigned(client):
45
+ result = client.managed_identity.update_with_user_assigned_and_system_assigned(
46
46
  resource_group_name=RESOURCE_GROUP_NAME,
47
47
  managed_identity_tracked_resource_name="identity",
48
48
  properties=models.ManagedIdentityTrackedResource(
@@ -4,8 +4,8 @@
4
4
  # license information.
5
5
  # --------------------------------------------------------------------------
6
6
  import pytest
7
- from azure.resourcemanager.models.resources import ResourcesClient
8
- from azure.resourcemanager.models.resources import models
7
+ from azure.resourcemanager.resources import ResourcesClient
8
+ from azure.resourcemanager.resources import models
9
9
 
10
10
  SUBSCRIPTION_ID = "00000000-0000-0000-0000-000000000000"
11
11
  RESOURCE_GROUP_NAME = "test-rg"
@@ -33,15 +33,15 @@ def test_client_signature(credential, authentication_policy):
33
33
  )
34
34
  for client in [client1, client2]:
35
35
  # make sure signautre order is correct
36
- client.top_level_tracked_resources.get(RESOURCE_GROUP_NAME, "top")
36
+ client.top_level.get(RESOURCE_GROUP_NAME, "top")
37
37
  # make sure signautre name is correct
38
- client.top_level_tracked_resources.get(
38
+ client.top_level.get(
39
39
  resource_group_name=RESOURCE_GROUP_NAME, top_level_tracked_resource_name="top"
40
40
  )
41
41
 
42
42
 
43
- def test_top_level_tracked_resources_begin_create_or_replace(client):
44
- result = client.top_level_tracked_resources.begin_create_or_replace(
43
+ def test_top_level_begin_create_or_replace(client):
44
+ result = client.top_level.begin_create_or_replace(
45
45
  resource_group_name=RESOURCE_GROUP_NAME,
46
46
  top_level_tracked_resource_name="top",
47
47
  resource=models.TopLevelTrackedResource(
@@ -56,12 +56,12 @@ def test_top_level_tracked_resources_begin_create_or_replace(client):
56
56
  assert result.properties.description == "valid"
57
57
  assert result.properties.provisioning_state == "Succeeded"
58
58
  assert result.name == "top"
59
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
59
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
60
60
  assert result.system_data.created_by == "AzureSDK"
61
61
 
62
62
 
63
- def test_top_level_tracked_resources_begin_update(client):
64
- result = client.top_level_tracked_resources.begin_update(
63
+ def test_top_level_begin_update(client):
64
+ result = client.top_level.begin_update(
65
65
  resource_group_name=RESOURCE_GROUP_NAME,
66
66
  top_level_tracked_resource_name="top",
67
67
  properties=models.TopLevelTrackedResource(
@@ -76,20 +76,20 @@ def test_top_level_tracked_resources_begin_update(client):
76
76
  assert result.properties.description == "valid2"
77
77
  assert result.properties.provisioning_state == "Succeeded"
78
78
  assert result.name == "top"
79
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
79
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
80
80
  assert result.system_data.created_by == "AzureSDK"
81
81
 
82
82
 
83
- def test_top_level_tracked_resources_begin_delete(client):
84
- client.top_level_tracked_resources.begin_delete(
83
+ def test_top_level_begin_delete(client):
84
+ client.top_level.begin_delete(
85
85
  resource_group_name=RESOURCE_GROUP_NAME,
86
86
  top_level_tracked_resource_name="top",
87
87
  polling_interval=0, # set polling_interval to 0 s to make the test faster since default is 30s
88
88
  ).result()
89
89
 
90
90
 
91
- def test_top_level_tracked_resources_list_by_resource_group(client):
92
- response = client.top_level_tracked_resources.list_by_resource_group(
91
+ def test_top_level_list_by_resource_group(client):
92
+ response = client.top_level.list_by_resource_group(
93
93
  resource_group_name=RESOURCE_GROUP_NAME,
94
94
  )
95
95
  result = [r for r in response]
@@ -98,24 +98,24 @@ def test_top_level_tracked_resources_list_by_resource_group(client):
98
98
  assert result.properties.description == "valid"
99
99
  assert result.properties.provisioning_state == "Succeeded"
100
100
  assert result.name == "top"
101
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
101
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
102
102
  assert result.system_data.created_by == "AzureSDK"
103
103
 
104
104
 
105
- def test_top_level_tracked_resources_list_by_subscription(client):
106
- response = client.top_level_tracked_resources.list_by_subscription()
105
+ def test_top_level_list_by_subscription(client):
106
+ response = client.top_level.list_by_subscription()
107
107
  result = [r for r in response]
108
108
  for result in result:
109
109
  assert result.location == "eastus"
110
110
  assert result.properties.description == "valid"
111
111
  assert result.properties.provisioning_state == "Succeeded"
112
112
  assert result.name == "top"
113
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources"
113
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources"
114
114
  assert result.system_data.created_by == "AzureSDK"
115
115
 
116
116
 
117
- def test_nested_proxy_resources_get(client):
118
- result = client.nested_proxy_resources.get(
117
+ def test_nested_get(client):
118
+ result = client.nested.get(
119
119
  resource_group_name=RESOURCE_GROUP_NAME,
120
120
  top_level_tracked_resource_name="top",
121
121
  nexted_proxy_resource_name="nested",
@@ -123,12 +123,12 @@ def test_nested_proxy_resources_get(client):
123
123
  assert result.properties.description == "valid"
124
124
  assert result.properties.provisioning_state == "Succeeded"
125
125
  assert result.name == "nested"
126
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
126
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
127
127
  assert result.system_data.created_by == "AzureSDK"
128
128
 
129
129
 
130
- def test_nested_proxy_resources_begin_create_or_replace(client):
131
- result = client.nested_proxy_resources.begin_create_or_replace(
130
+ def test_nested_begin_create_or_replace(client):
131
+ result = client.nested.begin_create_or_replace(
132
132
  resource_group_name=RESOURCE_GROUP_NAME,
133
133
  top_level_tracked_resource_name="top",
134
134
  nexted_proxy_resource_name="nested",
@@ -142,12 +142,12 @@ def test_nested_proxy_resources_begin_create_or_replace(client):
142
142
  assert result.properties.description == "valid"
143
143
  assert result.properties.provisioning_state == "Succeeded"
144
144
  assert result.name == "nested"
145
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
145
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
146
146
  assert result.system_data.created_by == "AzureSDK"
147
147
 
148
148
 
149
- def test_nested_proxy_resources_begin_update(client):
150
- result = client.nested_proxy_resources.begin_update(
149
+ def test_nested_begin_update(client):
150
+ result = client.nested.begin_update(
151
151
  resource_group_name=RESOURCE_GROUP_NAME,
152
152
  top_level_tracked_resource_name="top",
153
153
  nexted_proxy_resource_name="nested",
@@ -161,12 +161,12 @@ def test_nested_proxy_resources_begin_update(client):
161
161
  assert result.properties.description == "valid2"
162
162
  assert result.properties.provisioning_state == "Succeeded"
163
163
  assert result.name == "nested"
164
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
164
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
165
165
  assert result.system_data.created_by == "AzureSDK"
166
166
 
167
167
 
168
- def test_nested_proxy_resources_begin_delete(client):
169
- client.nested_proxy_resources.begin_delete(
168
+ def test_nested_begin_delete(client):
169
+ client.nested.begin_delete(
170
170
  resource_group_name=RESOURCE_GROUP_NAME,
171
171
  top_level_tracked_resource_name="top",
172
172
  nexted_proxy_resource_name="nested",
@@ -174,8 +174,8 @@ def test_nested_proxy_resources_begin_delete(client):
174
174
  ).result()
175
175
 
176
176
 
177
- def test_nested_proxy_resources_list_by_top_level_tracked_resource(client):
178
- response = client.nested_proxy_resources.list_by_top_level_tracked_resource(
177
+ def test_nested_list_by_top_level_tracked_resource(client):
178
+ response = client.nested.list_by_top_level_tracked_resource(
179
179
  resource_group_name=RESOURCE_GROUP_NAME,
180
180
  top_level_tracked_resource_name="top",
181
181
  )
@@ -184,31 +184,31 @@ def test_nested_proxy_resources_list_by_top_level_tracked_resource(client):
184
184
  assert result.properties.description == "valid"
185
185
  assert result.properties.provisioning_state == "Succeeded"
186
186
  assert result.name == "nested"
187
- assert result.type == "Azure.ResourceManager.Models.Resources/topLevelTrackedResources/top/nestedProxyResources"
187
+ assert result.type == "Azure.ResourceManager.Resources/topLevelTrackedResources/top/nestedProxyResources"
188
188
  assert result.system_data.created_by == "AzureSDK"
189
189
 
190
190
 
191
- def test_top_level_tracked_resources_action_sync(client):
192
- client.top_level_tracked_resources.action_sync(
191
+ def test_top_level_action_sync(client):
192
+ client.top_level.action_sync(
193
193
  resource_group_name=RESOURCE_GROUP_NAME,
194
194
  top_level_tracked_resource_name="top",
195
195
  body={"message": "Resource action at top level.", "urgent": True},
196
196
  )
197
197
 
198
198
 
199
- def test_singleton_tracked_resources_get_by_resource_group(client):
200
- result = client.singleton_tracked_resources.get_by_resource_group(
199
+ def test_singleton_get_by_resource_group(client):
200
+ result = client.singleton.get_by_resource_group(
201
201
  resource_group_name=RESOURCE_GROUP_NAME,
202
202
  )
203
203
  assert result.properties.description == "valid"
204
204
  assert result.properties.provisioning_state == "Succeeded"
205
205
  assert result.name == "default"
206
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
206
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
207
207
  assert result.system_data.created_by == "AzureSDK"
208
208
 
209
209
 
210
- def test_singleton_tracked_resources_begin_create_or_replace(client):
211
- result = client.singleton_tracked_resources.begin_create_or_update(
210
+ def test_singleton_begin_create_or_replace(client):
211
+ result = client.singleton.begin_create_or_update(
212
212
  resource_group_name=RESOURCE_GROUP_NAME,
213
213
  resource=models.SingletonTrackedResource(
214
214
  location="eastus",
@@ -220,12 +220,12 @@ def test_singleton_tracked_resources_begin_create_or_replace(client):
220
220
  assert result.properties.description == "valid"
221
221
  assert result.properties.provisioning_state == "Succeeded"
222
222
  assert result.name == "default"
223
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
223
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
224
224
  assert result.system_data.created_by == "AzureSDK"
225
225
 
226
226
 
227
- def test_singleton_tracked_resources_update(client):
228
- result = client.singleton_tracked_resources.update(
227
+ def test_singleton_update(client):
228
+ result = client.singleton.update(
229
229
  resource_group_name=RESOURCE_GROUP_NAME,
230
230
  properties=models.SingletonTrackedResource(
231
231
  location="eastus2",
@@ -237,12 +237,12 @@ def test_singleton_tracked_resources_update(client):
237
237
  assert result.properties.description == "valid2"
238
238
  assert result.properties.provisioning_state == "Succeeded"
239
239
  assert result.name == "default"
240
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
240
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
241
241
  assert result.system_data.created_by == "AzureSDK"
242
242
 
243
243
 
244
- def test_singleton_tracked_resources_list_by_resource_group(client):
245
- response = client.singleton_tracked_resources.list_by_resource_group(
244
+ def test_singleton_list_by_resource_group(client):
245
+ response = client.singleton.list_by_resource_group(
246
246
  resource_group_name=RESOURCE_GROUP_NAME,
247
247
  )
248
248
  result = [r for r in response]
@@ -250,5 +250,5 @@ def test_singleton_tracked_resources_list_by_resource_group(client):
250
250
  assert result.properties.description == "valid"
251
251
  assert result.properties.provisioning_state == "Succeeded"
252
252
  assert result.name == "default"
253
- assert result.type == "Azure.ResourceManager.Models.Resources/singletonTrackedResources"
253
+ assert result.type == "Azure.ResourceManager.Resources/singletonTrackedResources"
254
254
  assert result.system_data.created_by == "AzureSDK"