The default approach involves using TestClient. However, I found that mocking the database, background tasks, etc., is overkill. Do you have any suggestions?

  • bradbeattie@lemmy.ca
    link
    fedilink
    arrow-up
    1
    ·
    1 month ago

    If you don’t want to test the round trip, have your fastapi routes call some other function and test just that function.

    • vi21@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      4 days ago

      Do you mean moving Pydantic models as arguments of other function?