O'Reilly logo

Learning Flask Framework by Charles Leifer, Matt Copperwaite

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required