@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.
- 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/dist/emitter/http.d.ts.map +1 -1
- package/dist/emitter/http.js +14 -2
- package/dist/emitter/http.js.map +1 -1
- package/emitter/src/code-model.ts +15 -2
- package/emitter/src/http.ts +22 -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/pygen/codegen/serializers/operations_init_serializer.py +1 -1
- package/generator/pygen/codegen/templates/init.py.jinja2 +1 -1
- package/generator/pygen/codegen/templates/model_init.py.jinja2 +6 -2
- 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 +5 -5
|
@@ -15,60 +15,60 @@ def client():
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def test_no_decorator_in_public(client: AccessClient):
|
|
18
|
-
result = client.public_operation.no_decorator_in_public(name="
|
|
19
|
-
assert result == models.NoDecoratorModelInPublic(name="
|
|
18
|
+
result = client.public_operation.no_decorator_in_public(name="sample")
|
|
19
|
+
assert result == models.NoDecoratorModelInPublic(name="sample")
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
def test_public_decorator_in_public(client: AccessClient):
|
|
23
|
-
result = client.public_operation.public_decorator_in_public(name="
|
|
24
|
-
assert result == models.PublicDecoratorModelInPublic(name="
|
|
23
|
+
result = client.public_operation.public_decorator_in_public(name="sample")
|
|
24
|
+
assert result == models.PublicDecoratorModelInPublic(name="sample")
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def test_no_decorator_in_internal(client: AccessClient):
|
|
28
|
-
result = client.internal_operation._no_decorator_in_internal(name="
|
|
29
|
-
assert result == models._models.NoDecoratorModelInInternal(name="
|
|
28
|
+
result = client.internal_operation._no_decorator_in_internal(name="sample")
|
|
29
|
+
assert result == models._models.NoDecoratorModelInInternal(name="sample")
|
|
30
30
|
|
|
31
31
|
with pytest.raises(ImportError):
|
|
32
32
|
from specs.azure.clientgenerator.core.access.models import NoDecoratorModelInInternal
|
|
33
33
|
|
|
34
34
|
with pytest.raises(AttributeError):
|
|
35
|
-
client.internal_operation.no_decorator_in_internal(name="
|
|
35
|
+
client.internal_operation.no_decorator_in_internal(name="sample")
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
def test_internal_decorator_in_internal(client: AccessClient):
|
|
39
|
-
result = client.internal_operation._internal_decorator_in_internal(name="
|
|
40
|
-
assert result == models._models.InternalDecoratorModelInInternal(name="
|
|
39
|
+
result = client.internal_operation._internal_decorator_in_internal(name="sample")
|
|
40
|
+
assert result == models._models.InternalDecoratorModelInInternal(name="sample")
|
|
41
41
|
|
|
42
42
|
with pytest.raises(ImportError):
|
|
43
43
|
from specs.azure.clientgenerator.core.access.models import InternalDecoratorModelInInternal
|
|
44
44
|
|
|
45
45
|
with pytest.raises(AttributeError):
|
|
46
|
-
client.internal_operation.internal_decorator_in_internal(name="
|
|
46
|
+
client.internal_operation.internal_decorator_in_internal(name="sample")
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def test_public_decorator_in_internal(client: AccessClient):
|
|
50
|
-
result = client.internal_operation._public_decorator_in_internal(name="
|
|
51
|
-
assert result == models.PublicDecoratorModelInInternal(name="
|
|
50
|
+
result = client.internal_operation._public_decorator_in_internal(name="sample")
|
|
51
|
+
assert result == models.PublicDecoratorModelInInternal(name="sample")
|
|
52
52
|
|
|
53
53
|
with pytest.raises(AttributeError):
|
|
54
|
-
client.internal_operation.public_decorator_in_internal(name="
|
|
54
|
+
client.internal_operation.public_decorator_in_internal(name="sample")
|
|
55
55
|
|
|
56
56
|
|
|
57
57
|
def test_public(client: AccessClient):
|
|
58
|
-
result = client.shared_model_in_operation.public(name="
|
|
59
|
-
assert result == models.SharedModel(name="
|
|
58
|
+
result = client.shared_model_in_operation.public(name="sample")
|
|
59
|
+
assert result == models.SharedModel(name="sample")
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
def test_internal(client: AccessClient):
|
|
63
|
-
result = client.shared_model_in_operation._internal(name="
|
|
64
|
-
assert result == models.SharedModel(name="
|
|
63
|
+
result = client.shared_model_in_operation._internal(name="sample")
|
|
64
|
+
assert result == models.SharedModel(name="sample")
|
|
65
65
|
|
|
66
66
|
with pytest.raises(AttributeError):
|
|
67
|
-
client.shared_model_in_operation.internal(name="
|
|
67
|
+
client.shared_model_in_operation.internal(name="sample")
|
|
68
68
|
|
|
69
69
|
|
|
70
70
|
def test_operation(client: AccessClient):
|
|
71
|
-
result = client.relative_model_in_operation._operation(name="
|
|
71
|
+
result = client.relative_model_in_operation._operation(name="Madge")
|
|
72
72
|
assert result == models._models.OuterModel(name="Madge", inner=models._models.InnerModel(name="Madge"))
|
|
73
73
|
|
|
74
74
|
with pytest.raises(ImportError):
|
|
@@ -78,7 +78,7 @@ def test_operation(client: AccessClient):
|
|
|
78
78
|
from specs.azure.clientgenerator.core.access.models import InnerModel
|
|
79
79
|
|
|
80
80
|
with pytest.raises(AttributeError):
|
|
81
|
-
client.shared_model_in_operation.operation(name="
|
|
81
|
+
client.shared_model_in_operation.operation(name="sample")
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
def test_discriminator(client: AccessClient):
|
|
@@ -22,8 +22,8 @@ mypy==1.10.1
|
|
|
22
22
|
-e ./generated/azure-core-page
|
|
23
23
|
-e ./generated/azure-special-headers-client-request-id/
|
|
24
24
|
-e ./generated/azure-example-basic
|
|
25
|
-
-e ./generated/azure-resource-manager-
|
|
26
|
-
-e ./generated/azure-resource-manager-
|
|
25
|
+
-e ./generated/azure-resource-manager-common-properties
|
|
26
|
+
-e ./generated/azure-resource-manager-resources
|
|
27
27
|
|
|
28
28
|
# common test case
|
|
29
29
|
-e ./generated/authentication-api-key
|
|
@@ -17,8 +17,8 @@ from authentication.union.aio import UnionClient
|
|
|
17
17
|
async def api_key_client(key_credential):
|
|
18
18
|
client = None
|
|
19
19
|
|
|
20
|
-
def _build_client(client_type):
|
|
21
|
-
client = client_type(key_credential(
|
|
20
|
+
def _build_client(client_type, key: str = "valid-key"):
|
|
21
|
+
client = client_type(key_credential(key))
|
|
22
22
|
return client
|
|
23
23
|
|
|
24
24
|
yield _build_client
|
|
@@ -53,8 +53,8 @@ async def oauth2_client(token_credential):
|
|
|
53
53
|
async def http_custom_client(key_credential):
|
|
54
54
|
client = None
|
|
55
55
|
|
|
56
|
-
def _build_client():
|
|
57
|
-
client = CustomClient(key_credential(
|
|
56
|
+
def _build_client(key: str = "valid-key"):
|
|
57
|
+
client = CustomClient(key_credential(key))
|
|
58
58
|
return client
|
|
59
59
|
|
|
60
60
|
yield _build_client
|
|
@@ -73,7 +73,7 @@ async def test_api_key_valid(api_key_client):
|
|
|
73
73
|
|
|
74
74
|
@pytest.mark.asyncio
|
|
75
75
|
async def test_api_key_invalid(api_key_client, core_library):
|
|
76
|
-
client = api_key_client(ApiKeyClient)
|
|
76
|
+
client = api_key_client(ApiKeyClient, "invalid-key")
|
|
77
77
|
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
78
78
|
await client.invalid()
|
|
79
79
|
assert ex.value.status_code == 403
|
|
@@ -114,7 +114,7 @@ async def test_http_custom_valid(http_custom_client):
|
|
|
114
114
|
|
|
115
115
|
@pytest.mark.asyncio
|
|
116
116
|
async def test_http_custom_invalid(http_custom_client, core_library):
|
|
117
|
-
client = http_custom_client()
|
|
117
|
+
client = http_custom_client(key="invalid-key")
|
|
118
118
|
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
119
119
|
await client.invalid()
|
|
120
120
|
assert ex.value.status_code == 403
|
|
@@ -17,8 +17,8 @@ from authentication.http.custom import CustomClient
|
|
|
17
17
|
def api_key_client(key_credential):
|
|
18
18
|
client = None
|
|
19
19
|
|
|
20
|
-
def _build_client(client_type):
|
|
21
|
-
client = client_type(key_credential(
|
|
20
|
+
def _build_client(client_type, key: str = "valid-key"):
|
|
21
|
+
client = client_type(key_credential(key))
|
|
22
22
|
return client
|
|
23
23
|
|
|
24
24
|
yield _build_client
|
|
@@ -53,8 +53,8 @@ def oauth2_client(token_credential):
|
|
|
53
53
|
def http_custom_client(key_credential):
|
|
54
54
|
client = None
|
|
55
55
|
|
|
56
|
-
def _build_client():
|
|
57
|
-
client = CustomClient(key_credential(
|
|
56
|
+
def _build_client(key: str = "valid-key"):
|
|
57
|
+
client = CustomClient(key_credential(key))
|
|
58
58
|
return client
|
|
59
59
|
|
|
60
60
|
yield _build_client
|
|
@@ -71,7 +71,7 @@ def test_api_key_valid(api_key_client):
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
def test_api_key_invalid(api_key_client, core_library):
|
|
74
|
-
client = api_key_client(ApiKeyClient)
|
|
74
|
+
client = api_key_client(ApiKeyClient, "invalid-key")
|
|
75
75
|
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
76
76
|
client.invalid()
|
|
77
77
|
assert ex.value.status_code == 403
|
|
@@ -106,7 +106,7 @@ def test_http_custom_valid(http_custom_client):
|
|
|
106
106
|
|
|
107
107
|
|
|
108
108
|
def test_http_custom_invalid(http_custom_client, core_library):
|
|
109
|
-
client = http_custom_client()
|
|
109
|
+
client = http_custom_client("invalid-key")
|
|
110
110
|
with pytest.raises(core_library.exceptions.HttpResponseError) as ex:
|
|
111
111
|
client.invalid()
|
|
112
112
|
assert ex.value.status_code == 403
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typespec/http-client-python",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec emitter for Python SDKs",
|
|
6
6
|
"homepage": "https://typespec.io",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@azure-tools/typespec-azure-core": ">=0.47.0 <1.0.0",
|
|
55
55
|
"@azure-tools/typespec-azure-resource-manager": ">=0.47.0 <1.0.0",
|
|
56
56
|
"@azure-tools/typespec-autorest": ">=0.47.0 <1.0.0",
|
|
57
|
-
"@azure-tools/typespec-client-generator-core": ">=0.47.
|
|
57
|
+
"@azure-tools/typespec-client-generator-core": ">=0.47.4 <1.0.0",
|
|
58
58
|
"@azure-tools/typespec-azure-rulesets": ">=0.47.0 <3.0.0",
|
|
59
59
|
"@typespec/compiler": ">=0.61.0 <1.0.0",
|
|
60
60
|
"@typespec/http": ">=0.61.0 <1.0.0",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@azure-tools/typespec-azure-resource-manager": "~0.47.0",
|
|
71
71
|
"@azure-tools/typespec-autorest": "~0.47.0",
|
|
72
|
-
"@azure-tools/cadl-ranch-expect": "0.15.5",
|
|
73
|
-
"@azure-tools/cadl-ranch-specs": "0.
|
|
72
|
+
"@azure-tools/cadl-ranch-expect": "~0.15.5",
|
|
73
|
+
"@azure-tools/cadl-ranch-specs": "~0.39.0",
|
|
74
74
|
"@types/js-yaml": "~4.0.5",
|
|
75
75
|
"@types/node": "~22.5.4",
|
|
76
76
|
"@types/semver": "7.5.8",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"typescript": "~5.6.2",
|
|
81
81
|
"typescript-eslint": "^8.5.0",
|
|
82
82
|
"@azure-tools/typespec-azure-core": "~0.47.0",
|
|
83
|
-
"@azure-tools/typespec-client-generator-core": "~0.47.
|
|
83
|
+
"@azure-tools/typespec-client-generator-core": "~0.47.4",
|
|
84
84
|
"@typespec/compiler": "~0.61.0",
|
|
85
85
|
"@typespec/http": "~0.61.0",
|
|
86
86
|
"@typespec/rest": "~0.61.0",
|