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 mock API tests for client response replacement.
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():
Comment thread
msyyc marked this conversation as resolved.
Resolved
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")


Comment on lines +18 to +22
@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):
Comment on lines +17 to +21
assert client.bytes_response() == Widget(name="widget")
Loading