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