PacktPublishing / Building-Data-Science-Applications-with-FastAPI

Building Data Science Applications with FastAPI, Published by Packt
MIT License
306 stars 157 forks source link

Chapter 9 external api test is missing the test function #13

Closed JamesCHub closed 1 year ago

JamesCHub commented 1 year ago

chapter9_app_external_api_test.py in this code repo has the fixtures, but is missing the actual test function

From the book:

@pytest.mark.asyncio
async def test_get_employees(test_client: httpx.AsyncClient):
    response = await test_client.get("/employees")

    assert response.status_code == status.HTTP_200_OK

    json = response.json()
    assert json == MockExternalAPI.mock_data
    return response.json()

If you try to test the code as is you get a "no tests ran" message. Have to add the test function (above) to the test.py

frankie567 commented 1 year ago

Hi @JamesCHub 👋

You're right! The code shown in the book is actually correct. I've fixed the code examples! Thank you for your vigilance 👍