Skip to content

Commit 33a84a2

Browse files
authored
[Python] add test case for client-operation-group (#8618)
1 parent 0e1bc51 commit 33a84a2

File tree

7 files changed

+73
-6
lines changed

7 files changed

+73
-6
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@typespec/http-client-python"
5+
---
6+
7+
Add test case for client operation group

packages/http-client-python/eng/scripts/ci/regenerate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const argv = parseArgs({
2222
});
2323

2424
// Add this near the top with other constants
25-
const SKIP_SPECS = ["type/union/discriminated", "client-operation-group"];
25+
const SKIP_SPECS = ["type/union/discriminated"];
2626

2727
// Get the directory of the current file
2828
const PLUGIN_DIR = argv.values.pluginDir
@@ -103,6 +103,10 @@ const AZURE_EMITTER_OPTIONS: Record<string, Record<string, string> | Record<stri
103103
"client/structure/default": {
104104
namespace: "client.structure.service",
105105
},
106+
"client/structure/client-operation-group": {
107+
"package-name": "client-structure-clientoperationgroup",
108+
namespace: "client.structure.clientoperationgroup",
109+
},
106110
"client/structure/multi-client": {
107111
"package-name": "client-structure-multiclient",
108112
namespace: "client.structure.multiclient",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
import pytest
7+
from client.structure.clientoperationgroup.models import ClientType
8+
from client.structure.clientoperationgroup.aio import FirstClient, SecondClient
9+
10+
11+
@pytest.mark.asyncio
12+
async def test_first_client_operations():
13+
client = FirstClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
14+
15+
await client.one()
16+
17+
await client.group3.two()
18+
await client.group3.three()
19+
20+
await client.group4.four()
21+
22+
23+
@pytest.mark.asyncio
24+
async def test_second_client_operations():
25+
client = SecondClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
26+
27+
await client.five()
28+
29+
await client.group5.six()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See License.txt in the project root for
4+
# license information.
5+
# --------------------------------------------------------------------------
6+
from client.structure.clientoperationgroup.models import ClientType
7+
from client.structure.clientoperationgroup import FirstClient, SecondClient
8+
9+
10+
def test_first_client_operations():
11+
client = FirstClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
12+
13+
client.one()
14+
15+
client.group3.two()
16+
client.group3.three()
17+
18+
client.group4.four()
19+
20+
21+
def test_second_client_operations():
22+
client = SecondClient(endpoint="http://localhost:3000", client=ClientType.CLIENT_OPERATION_GROUP)
23+
24+
client.five()
25+
26+
client.group5.six()

packages/http-client-python/generator/test/azure/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ azure-mgmt-core==1.6.0
3636
-e ./generated/client-naming-enum-conflict
3737
-e ./generated/client-overload
3838
-e ./generated/client-structure-default
39+
-e ./generated/client-structure-clientoperationgroup
3940
-e ./generated/client-structure-multiclient
4041
-e ./generated/client-structure-renamedoperation
4142
-e ./generated/client-structure-twooperationgroup

packages/http-client-python/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/http-client-python/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"@azure-tools/typespec-azure-resource-manager": "~0.60.0",
8383
"@azure-tools/typespec-azure-rulesets": "~0.60.0",
8484
"@azure-tools/typespec-client-generator-core": "~0.60.2",
85-
"@azure-tools/azure-http-specs": "0.1.0-alpha.30-dev.5",
85+
"@azure-tools/azure-http-specs": "0.1.0-alpha.30-dev.6",
8686
"@typespec/compiler": "^1.4.0",
8787
"@typespec/http": "^1.4.0",
8888
"@typespec/openapi": "^1.4.0",

0 commit comments

Comments
 (0)