-
Notifications
You must be signed in to change notification settings - Fork 13
Unit Test
Test data is generated by model_mommy
, instead of provided by Django fixtures. model_mommy
automatically creates all required foreign key relationships and populates them with arbitrary data, and thus the test data can focus on the most important aspects of the model and is not subject to any changes in Rodan model.
A test case should inherit RodanTestSetUpMixin
and RodanTestTearDownMixin
together with REST Framework's APITestCase
. RodanTestSetUpMixin
provides several methods named setUp_xxx()
to create objects using model_mommy
and attach them to self
. RodanTestTearDownMixin
deletes the temporary folder used during test. It should be noted that the Project
and Resource
folders during test are not the same with production folder -- during the test the media folder is set to a temporary folder and RodanTestTearDownMixin
cleans the temporary filesystem. Therefore, the sequence of the base classes is important:
class MyRodanTestCase(RodanTestTearDownMixin, APITestCase, RodanTestSetUpMixin)
RodanTestTearDownMixin
must be put as the first of the list to mask the empty tearDown
method of APITestCase
.
The tests on views use superuser to perform to avoid being connected with permission system. The permission test is provided as separate test classes.
- Repository Structure
- Working on Rodan
- Testing Production Locally
- Working on Interactive Classifier
- Job Queues
- Testing New Docker Images
- Set up Environment Variables
- Set up SSL with Certbot
- Set up SSH with GitHub
- Deploying on Staging
- Deploying on Production
- Import Previous Data