From 8a08e60fabb4c93c546f668fae73a921f88d4daf Mon Sep 17 00:00:00 2001 From: manuelsommer <47991713+manuel-sommer@users.noreply.github.com> Date: Sat, 2 Nov 2024 02:59:22 +0100 Subject: [PATCH] fix unittest documentation #11128 (#11143) * fix unittest documentation #11128 * udpate * Update docs/content/en/contributing/how-to-write-a-parser.md Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> * Update docs/content/en/contributing/how-to-write-a-parser.md Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> --------- Co-authored-by: Charles Neill <1749665+cneill@users.noreply.github.com> --- .../en/contributing/how-to-write-a-parser.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/docs/content/en/contributing/how-to-write-a-parser.md b/docs/content/en/contributing/how-to-write-a-parser.md index c87846cb620..5652f0dbc59 100644 --- a/docs/content/en/contributing/how-to-write-a-parser.md +++ b/docs/content/en/contributing/how-to-write-a-parser.md @@ -16,9 +16,9 @@ All commands assume that you're located at the root of the django-DefectDojo clo - It's advised that you create a dedicated branch for your development, such as `git checkout -b parser-name`. It is easiest to use the docker compose deployment as it has hot-reload capbility for uWSGI. -Set up your environment to use the debug environment: +Set up your environment to use the dev environment: -`$ docker/setEnv.sh debug` +`$ docker/setEnv.sh dev` Please have a look at [DOCKER.md](https://github.com/DefectDojo/django-DefectDojo/blob/master/readme-docs/DOCKER.md) for more details. @@ -294,12 +294,24 @@ This local command will launch the unit test for your new parser $ docker compose exec uwsgi bash -c 'python manage.py test unittests.tools.. -v2' {{< /highlight >}} +or like this: + +{{< highlight bash >}} +$ ./dc-unittest.sh --test-case unittests.tools.. +{{< /highlight >}} + Example for the blackduck hub parser: {{< highlight bash >}} $ docker compose exec uwsgi bash -c 'python manage.py test unittests.tools.test_blackduck_csv_parser.TestBlackduckHubParser -v2' {{< /highlight >}} +or like this: + +{{< highlight bash >}} +$ ./dc-unittest.sh --test-case unittests.tools.test_blackduck_csv_parser.TestBlackduckHubParser +{{< /highlight >}} + {{% alert title="Information" color="info" %}} If you want to run all unit tests, simply run `$ docker compose exec uwsgi bash -c 'python manage.py test unittests -v2'` {{% /alert %}}