Chapter 8: Testing FastAPI Applications

In the last chapter, we learned how to secure a FastAPI application using OAuth and JSON Web Token (JWT). We successfully implemented an authentication system and learned what dependency injection is all about. We also learned how to inject dependencies into our routes to restrict unauthorized access and operations. We have successfully built a secure web API that has database support and is able to perform CRUD operations easily. In this chapter, we will learn what testing is and how to write tests to ensure that our application behaves as expected.

Testing is an integral part of the application development cycle. Application testing is done to ensure the correct functioning state of the application ...

Get Building Python Web APIs with FastAPI now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.