Skip to content

Commit 886269d

Browse files
committed
added test case
1 parent a46fde7 commit 886269d

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/test_api/test_api_sqla_with_includes.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from itertools import chain, zip_longest
44
from json import dumps
55
from typing import Dict, List
6-
from uuid import uuid4
6+
from uuid import UUID, uuid4
77

88
from fastapi import APIRouter, FastAPI, status
99
from httpx import AsyncClient
@@ -1667,6 +1667,22 @@ async def test_openapi_endpoint_ok(self, client: AsyncClient, app: FastAPI):
16671667
resp = response.json()
16681668
assert isinstance(resp, dict)
16691669

1670+
async def test_openapi_for_client_can_set_id(self):
1671+
class Schema(BaseModel):
1672+
id: UUID = Field(client_can_set_id=True)
1673+
1674+
app = build_app_custom(
1675+
model=User,
1676+
schema=Schema,
1677+
schema_in_post=Schema,
1678+
schema_in_patch=Schema,
1679+
resource_type="openapi_case_1",
1680+
)
1681+
1682+
async with AsyncClient(app=app, base_url="http://test") as client:
1683+
response = await client.get(app.openapi_url)
1684+
assert response.status_code == status.HTTP_200_OK, response.text
1685+
16701686

16711687
class TestFilters:
16721688
async def test_filters_really_works(

0 commit comments

Comments
 (0)