-
Notifications
You must be signed in to change notification settings - Fork 75
Testing
- Action:
.github/workflows/django_tests.yml
This action runs the Python standard tests and uploads the result to Codecov.
To test DFIRTrack you have the following possibilities:
- using Django's test-execution framework
- test the code coverage using
coverage
Make sure to install the requirements:
$ git clone https://github.com/stuhli/dfirtrack.git ~/dfirtrack
$ virtualenv -p /usr/bin/python3 ~/dfirtrack/venv
$ source ~/dfirtrack/venv/bin/activate
$ pip3 install -r ~/dfirtrack/requirements.txt
(venv) $ cd ~/dfirtrack
Start the tests and wait for the results:
(venv) $ python3 manage.py test --settings=dfirtrack.test_settings
Start the tests and monitor the results:
(venv) $ coverage run manage.py test --settings=dfirtrack.test_settings
Check the code coverage:
(venv) $ coverage report -m
- Action:
.github/workflows/lint_python.yml
This action performs various lint actions on the code.
Make sure to install the requirements:
$ source ~/dfirtrack/venv/bin/activate
$ pip3 install -r ~/dfirtrack/lint_requirements.txt
(venv) $ cd ~/dfirtrack
Most of the time your code will fail on black
.
To avoid this from the outset, it is best to do this locally.
(venv) $ black --skip-string-normalization .
Second most common problem that will occur is the sorting of imports.
This can also be tested locally.
It is important to know that isort
behaves differently depending on the path from which you start the test.
It is best to always run it from the root directory of the project.
This ensures that the results are the same as in the github action.
(venv) $ isort --profile black .
- Action:
.github/workflows/lint_ansible.yml
This action performs various lint actions on the Ansible playbook and role.
- Action:
.github/workflows/docker_publish.yml
This action creates current images based on the master
and develop
branch and uploads them to Docker.