[BUG] python-fastapi: pytest fails
Created by: Minyus
Description
pytest fails as follows:
#16 0.795 =================================== FAILURES ===================================
#16 0.795 _______________________________ test_place_order _______________________________
#16 0.795
#16 0.795 client = <starlette.testclient.TestClient object at 0x7f085de03210>
#16 0.795
#16 0.795 def test_place_order(client: TestClient):
#16 0.795 """Test case for place_order
#16 0.795
#16 0.795 Place an order for a pet
#16 0.795 """
#16 0.795 > body = openapi_server.Order()
#16 0.795 E NameError: name 'openapi_server' is not defined
#16 0.795
#16 0.795 tests/test_store_api.py:69: NameError
openapi-generator version
5.2.1
OpenAPI declaration file content or url
Generation Details
Run: docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v5.2.1 generate -i /local/openapi.yaml -g python-fastapi -o /local
Steps to reproduce
Run: docker-compose up
(or docker-compose build --no-cache
)
Related issues/PRs
None
Suggest a fix
Remove openapi_server.
and add .dict()
in the generated test code, for example:
Original:
body = openapi_server.Order()
Modification:
body = Order().dict()