Module for simple test parameters of model fields. It compares values of field parameters with expected. It needs for avoid random changes of parameters.
- Download wheel package
- If you use virtualenv, you need select needed environment by
virtualenv local name_your_env
- Run command
python3 -m pip install path_to_wheel_package
- Clone it repo by
git clone https://github.com/nongreen/django_test_parameters_of_fields
- Change directory to tests/test_project/
- Run commands:
python manage.py makemigrations
python manage.py sqlmigrate test_app 0001
python manage.py migrate
- Import module by
from expected_model import expected_model
- Create ExpectedModel with parameters of fields like dictionaries. Example
id = {"primary_key": True}
, whereid
is name in tested model,"primary_key"
is tested parameter,True
is expected value of parameter - Create test with compare ExpectedModel with TestedModel like
ExpectedModel() == TestedModel()
.Important: compare must not to be
TestedModel() == ExpectedModel()