Activity 14.01 – testing models and views in Bookr
In this activity, you will implement test cases for the Bookr project. You will implement test cases to validate the functioning of the models created inside the reviews application of the Bookr project, and then you will implement a simple test case for validating the index view inside the reviews application.
The following steps will help you work through this activity:
- Create a directory named
tests
inside the reviews application directory so that all our test cases for the reviews application can be modularized. - Create an empty
__init__.py
file so that the directory is considered not as a general directory, but rather a Python module directory. - Create a new file named
test_models.py
for implementing the code for testing the models. Inside this file, import the models you want to test. - Inside the
test_models.py
file, create a new class that inherits from theTestCase
class of thedjango.tests
module...