Chapter 8. Testing Flask Apps
In this chapter, we shall learn how to write unit tests covering all parts of the blogging app. We will utilize Flask's test client to simulate live requests, and we will see how the Mock library can simplify the testing of complex interactions, such as calling third-party services such as databases.
In this chapter we shall learn the following topics:
- Python's unit test module and general guidelines for test writing
- Test-friendly configuration
- How to simulate requests and sessions using the Flask test client
- How to use the Mock library to test complex interactions
- Logging exceptions and error e-mails
Unit testing
Unit Testing is a process that allows us to have confidence in the code, confidence in bug fixes, and confidence ...
Get Learning Flask Framework 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.