Skip to content
Draft
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 mock API tests for client response replacement.
10 changes: 5 additions & 5 deletions packages/http-client-python/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/http-client-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
"@azure-tools/typespec-azure-resource-manager": "~0.72.0",
"@azure-tools/typespec-azure-rulesets": "~0.72.0",
"@azure-tools/typespec-client-generator-core": "~0.72.0",
"@azure-tools/azure-http-specs": "0.1.0-alpha.45",
"@azure-tools/azure-http-specs": "0.1.0-alpha.46-dev.2",
"@typespec/compiler": "^1.16.0",
"@typespec/http": "^1.16.0",
"@typespec/openapi": "^1.16.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -------------------------------------------------------------------------
# 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 _specs_.azure.clientgenerator.core.responsereplacement.aio import ResponseReplacementClient
from _specs_.azure.clientgenerator.core.responsereplacement.models import Widget


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


@pytest.mark.asyncio
async def test_void_response(client: ResponseReplacementClient):
assert await client.void_response() == Widget(name="widget")


@pytest.mark.asyncio
async def test_bytes_response(client: ResponseReplacementClient):
assert await client.bytes_response() == Widget(name="widget")
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# -------------------------------------------------------------------------
# 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 _specs_.azure.clientgenerator.core.responsereplacement import ResponseReplacementClient
from _specs_.azure.clientgenerator.core.responsereplacement.models import Widget


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


def test_void_response(client: ResponseReplacementClient):
assert client.void_response() == Widget(name="widget")


def test_bytes_response(client: ResponseReplacementClient):
assert client.bytes_response() == Widget(name="widget")