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 test for `payload/head` scenario with `Content-Type` and `x-ms-meta` response headers.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -------------------------------------------------------------------------
# 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 payload.head.aio import HeadClient


@pytest_asyncio.fixture
async def client():
async with HeadClient(endpoint="http://localhost:3000") as client:
yield client


@pytest.mark.asyncio
async def test_content_type_header_in_response(client: HeadClient):
assert await client.content_type_header_in_response() is True


@pytest.mark.asyncio
async def test_content_type_header_in_response_with_cls(client: HeadClient):
headers = await client.content_type_header_in_response(cls=lambda x, y, z: z)
assert headers["Content-Type"] == "text/plain; charset=utf-8"
assert headers["x-ms-meta"] == "hello"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -------------------------------------------------------------------------
# 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 payload.head import HeadClient


@pytest.fixture
def client():
with HeadClient(endpoint="http://localhost:3000") as client:
yield client


def test_content_type_header_in_response(client: HeadClient):
assert client.content_type_header_in_response() is True
Comment thread
msyyc marked this conversation as resolved.


def test_content_type_header_in_response_with_cls(client: HeadClient):
headers = client.content_type_header_in_response(cls=lambda x, y, z: z)
assert headers["Content-Type"] == "text/plain; charset=utf-8"
assert headers["x-ms-meta"] == "hello"