Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
changeKind: internal
packages:
- "@typespec/http-client-python"
---

Add sync and async mock_api tests for the `service/multiple-services` Spector scenario and enable its regeneration.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ export interface BuildTaskGroupsOptions {

export const SKIP_SPECS: string[] = [
"type/file",
"service/multiple-services",
"azure/client-generator-core/response-as-bool",
];

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import pytest
import pytest_asyncio
from service.multipleservices.servicea.aio import ServiceAClient
from service.multipleservices.serviceb.aio import ServiceBClient


@pytest_asyncio.fixture
async def client_a():
async with ServiceAClient() as client:
yield client


@pytest_asyncio.fixture
async def client_b():
async with ServiceBClient() as client:
yield client


@pytest.mark.asyncio
async def test_service_a_op(client_a: ServiceAClient):
await client_a.operations.op_a()


@pytest.mark.asyncio
async def test_service_a_sub_namespace_op(client_a: ServiceAClient):
await client_a.sub_namespace.sub_op_a()


@pytest.mark.asyncio
async def test_service_b_op(client_b: ServiceBClient):
await client_b.operations.op_b()


@pytest.mark.asyncio
async def test_service_b_sub_namespace_op(client_b: ServiceBClient):
await client_b.sub_namespace.sub_op_b()
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
import pytest
from service.multipleservices.servicea import ServiceAClient
from service.multipleservices.serviceb import ServiceBClient


@pytest.fixture
def client_a():
with ServiceAClient() as client:
yield client


@pytest.fixture
def client_b():
with ServiceBClient() as client:
yield client


def test_service_a_op(client_a: ServiceAClient):
client_a.operations.op_a()


def test_service_a_sub_namespace_op(client_a: ServiceAClient):
client_a.sub_namespace.sub_op_a()


def test_service_b_op(client_b: ServiceBClient):
client_b.operations.op_b()


def test_service_b_sub_namespace_op(client_b: ServiceBClient):
client_b.sub_namespace.sub_op_b()