Write and Run the Tests for the Views
Learn to test the Django views.
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 just have the view that displays the empty form called add_catalogue_form
in the views.py
file.
Write the test for the views
Let’s write some tests for the views:
Get hands-on with 1400+ tech skills courses.