Search⌘ K
AI Features

Write and Run the Tests for the Views

Explore writing tests for Django views in the e-library application to handle form submissions and display book lists. Learn to write test classes interacting with the database and run tests that initially fail to validate your test coverage.

We'll cover the following...

To round up the e-library application, we’ll write tests for the views. The views will represent our application’s business logic. This means it serves as the code that receives a web request and sends a response back to the user. Here, there are two goals:

  • The first is to enable the form to be able to save a new book to the database.
  • The second is to display all the books to the users.

Currently, we ...