Book Image

Learning Flask Framework

Book Image

Learning Flask Framework

Overview of this book

Table of Contents (17 chapters)
Learning Flask Framework
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

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