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 Python mock API coverage for the default and explicitly selected Azure resource LRO results.
30 changes: 15 additions & 15 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.

6 changes: 3 additions & 3 deletions packages/http-client-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@
},
"devDependencies": {
"@azure-tools/typespec-autorest": "~0.74.0",
"@azure-tools/typespec-azure-core": "~0.74.0",
"@azure-tools/typespec-azure-core": "0.75.0-dev.2",
Comment thread
msyyc marked this conversation as resolved.
Resolved
"@azure-tools/typespec-azure-resource-manager": "~0.74.0",
"@azure-tools/typespec-azure-rulesets": "~0.74.0",
"@azure-tools/typespec-client-generator-core": "~0.74.0",
"@azure-tools/azure-http-specs": "0.1.0-alpha.47",
"@azure-tools/typespec-client-generator-core": "0.75.0-dev.4",
"@azure-tools/azure-http-specs": "0.1.0-alpha.48-dev.1",
"@typespec/compiler": "^1.18.0",
"@typespec/http": "^1.18.0",
"@typespec/openapi": "^1.18.0",
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 specs.azure.clientgenerator.core.lro.result import models
from specs.azure.clientgenerator.core.lro.result.aio import ResultClient


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


@pytest.mark.asyncio
async def test_lro_result_create_default(client):
poller = await client.begin_create_default(
id="default",
resource=models.Job(status="Running"),
polling_interval=0,
)
result = await poller.result()

assert result.id == "default"
assert result.status == "Succeeded"
assert result.result == models.JobResult(value="completed")


@pytest.mark.asyncio
async def test_lro_result_create_with_client_lro_result(client):
poller = await client.begin_create_with_client_lro_result(
id="client-result",
resource=models.Job(status="Running"),
polling_interval=0,
)
result = await poller.result()

assert result == models.JobResult(value="completed")
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# -------------------------------------------------------------------------
# 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.lro.result import ResultClient, models


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


def test_lro_result_create_default(client):
result = client.begin_create_default(
id="default",
resource=models.Job(status="Running"),
polling_interval=0,
).result()

assert result.id == "default"
assert result.status == "Succeeded"
assert result.result == models.JobResult(value="completed")


def test_lro_result_create_with_client_lro_result(client):
result = client.begin_create_with_client_lro_result(
id="client-result",
resource=models.Job(status="Running"),
polling_interval=0,
).result()

assert result == models.JobResult(value="completed")
Loading