@typespec/http-client-python 0.3.4 → 0.3.6
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.
- package/dist/emitter/code-model.d.ts.map +1 -1
- package/dist/emitter/code-model.js +15 -3
- package/dist/emitter/code-model.js.map +1 -1
- package/emitter/src/code-model.ts +15 -2
- package/emitter/temp/tsconfig.tsbuildinfo +1 -1
- package/eng/scripts/setup/__pycache__/venvtools.cpython-38.pyc +0 -0
- package/generator/dev_requirements.txt +1 -1
- 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
- package/generator/test/azure/mock_api_tests/asynctests/{test_azure_arm_models_resource_async.py → test_azure_arm_resource_async.py} +46 -46
- package/generator/test/azure/mock_api_tests/asynctests/test_azure_client_generator_core_access_async.py +20 -20
- package/generator/test/azure/mock_api_tests/{test_azure_arm_models_common_types_managed_identity.py → test_azure_arm_commonproperties.py} +9 -9
- package/generator/test/azure/mock_api_tests/{test_azure_arm_models_resource.py → test_azure_arm_resource.py} +46 -46
- package/generator/test/azure/mock_api_tests/test_azure_client_generator_core_access.py +20 -20
- package/generator/test/azure/requirements.txt +2 -2
- package/generator/test/generic_mock_api_tests/asynctests/test_authentication_async.py +6 -6
- package/generator/test/generic_mock_api_tests/test_authentication.py +6 -6
- package/package.json +27 -27
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import pytest
|
|
7
|
-
from azure.resourcemanager.
|
|
8
|
-
from azure.resourcemanager.
|
|
7
|
+
from azure.resourcemanager.commonproperties.aio 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,15 +13,15 @@ RESOURCE_GROUP_NAME = "test-rg"
|
|
|
13
13
|
|
|
14
14
|
@pytest.fixture
|
|
15
15
|
async def client(credential, authentication_policy):
|
|
16
|
-
async with
|
|
16
|
+
async 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
22
|
@pytest.mark.asyncio
|
|
23
|
-
async def
|
|
24
|
-
result = await client.
|
|
23
|
+
async def test_managed_identity_get(client):
|
|
24
|
+
result = await client.managed_identity.get(
|
|
25
25
|
resource_group_name=RESOURCE_GROUP_NAME, managed_identity_tracked_resource_name="identity"
|
|
26
26
|
)
|
|
27
27
|
assert result.location == "eastus"
|
|
@@ -30,8 +30,8 @@ async def test_managed_identity_tracked_resources_get(client):
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
@pytest.mark.asyncio
|
|
33
|
-
async def
|
|
34
|
-
result = await client.
|
|
33
|
+
async def test_managed_identity_create_with_system_assigned(client):
|
|
34
|
+
result = await client.managed_identity.create_with_system_assigned(
|
|
35
35
|
resource_group_name=RESOURCE_GROUP_NAME,
|
|
36
36
|
managed_identity_tracked_resource_name="identity",
|
|
37
37
|
resource=models.ManagedIdentityTrackedResource(
|
|
@@ -44,8 +44,8 @@ async def test_managed_identity_tracked_resources_create_with_system_assigned(cl
|
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
@pytest.mark.asyncio
|
|
47
|
-
async def
|
|
48
|
-
result = await client.
|
|
47
|
+
async def test_managed_identity_update_with_user_assigned_and_system_assigned(client):
|
|
48
|
+
result = await client.managed_identity.update_with_user_assigned_and_system_assigned(
|
|
49
49
|
resource_group_name=RESOURCE_GROUP_NAME,
|
|
50
50
|
managed_identity_tracked_resource_name="identity",
|
|
51
51
|
properties=models.ManagedIdentityTrackedResource(
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
# license information.
|
|
5
5
|
# --------------------------------------------------------------------------
|
|
6
6
|
import pytest
|
|
7
|
-
from azure.resourcemanager.
|
|
8
|
-
from azure.resourcemanager.
|
|
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.
|
|
37
|
+
await client.top_level.get(RESOURCE_GROUP_NAME, "top")
|
|
38
38
|
# make sure signautre name is correct
|
|
39
|
-
await client.
|
|
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
|
|
45
|
+
async def test_top_level_begin_create_or_replace(client):
|
|
46
46
|
result = await (
|
|
47
|
-
await client.
|
|
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.
|
|
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
|
|
68
|
+
async def test_top_level_begin_update(client):
|
|
69
69
|
result = await (
|
|
70
|
-
await client.
|
|
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.
|
|
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
|
|
91
|
+
async def test_top_level_begin_delete(client):
|
|
92
92
|
await (
|
|
93
|
-
await client.
|
|
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
|
|
103
|
-
response = client.
|
|
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.
|
|
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
|
|
118
|
-
response = client.
|
|
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.
|
|
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
|
|
131
|
-
result = await client.
|
|
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.
|
|
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
|
|
144
|
+
async def test_nested_begin_create_or_replace(client):
|
|
145
145
|
result = await (
|
|
146
|
-
await client.
|
|
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.
|
|
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
|
|
166
|
+
async def test_nested_begin_update(client):
|
|
167
167
|
result = await (
|
|
168
|
-
await client.
|
|
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.
|
|
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
|
|
188
|
+
async def test_nested_begin_delete(client):
|
|
189
189
|
await (
|
|
190
|
-
await client.
|
|
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
|
|
201
|
-
response = client.
|
|
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.
|
|
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
|
|
216
|
-
await client.
|
|
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
|
|
225
|
-
result = await client.
|
|
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.
|
|
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
|
|
236
|
+
async def test_singleton_begin_create_or_replace(client):
|
|
237
237
|
result = await (
|
|
238
|
-
await client.
|
|
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.
|
|
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
|
|
257
|
-
result = await client.
|
|
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.
|
|
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
|
|
275
|
-
response = client.
|
|
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.
|
|
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="
|
|
20
|
-
assert result == models.NoDecoratorModelInPublic(name="
|
|
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="
|
|
26
|
-
assert result == models.PublicDecoratorModelInPublic(name="
|
|
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="
|
|
32
|
-
assert result == models._models.NoDecoratorModelInInternal(name="
|
|
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="
|
|
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="
|
|
44
|
-
assert result == models._models.InternalDecoratorModelInInternal(name="
|
|
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="
|
|
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="
|
|
56
|
-
assert result == models.PublicDecoratorModelInInternal(name="
|
|
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="
|
|
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="
|
|
65
|
-
assert result == models.SharedModel(name="
|
|
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="
|
|
71
|
-
assert result == models.SharedModel(name="
|
|
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="
|
|
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="
|
|
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="
|
|
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.
|
|
8
|
-
from azure.resourcemanager.
|
|
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
|
|
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
|
|
23
|
-
result = client.
|
|
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
|
|
32
|
-
result = client.
|
|
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
|
|
45
|
-
result = client.
|
|
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(
|