Skip to content

Add all existing finding notes to the JIRA when created #6449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 15, 2022

Conversation

coheigea
Copy link
Contributor

@coheigea coheigea commented Jun 22, 2022

Tested locally correctly.

Fixes: #6434

Copy link
Contributor

@Maffooch Maffooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great change! We need some unit tests here though.

This would be a good place to add them. Be sure to read the block comment up top for use of the VCR recording (mimics the response from the jira server)

# these tests are using vcrpy to record traffic to and from JIRA: https://vcrpy.readthedocs.io/en/latest/usage.html
# after being recorded, the traffic is used for future runs of the tests
# this allows us to locally develop tests, run them, make them work against a real JIRA instance.
# after that we can commit the tests AND the recordings (cassettes).
# the record_mode is set to 'once' by default. this means it will replay responses from the cassette, if there is a cassette.
# otherwise it will create a new cassette and record responses. on the next run the cassette wil be used.
# if changing tests, you can best remove all cassettes before running the tests.
# or you can temporarily set the record_mode to all the make it always go to the real JIRA and record all the traffic.
# when the tests are finished, you'll have to set the assertCassettePlayed method to make it assert
# that all entries in the cassette have been used by the test.
# if you need some credentials for the Defect Dojo JIRA Cloud instance, contact one of the moderators
# some senstive data is filtered out by the filter_headers config option below
# as well as some custom callback functions to filter out cookies.
# please check the recorded files on sensitive data before committing to git

@coheigea
Copy link
Contributor Author

coheigea commented Jul 20, 2022

@Maffooch It looks like modifying test_import_with_push_to_jira_add_comment in that file to set push_to_jira=false on the initial import, then add the comment and push to JIRA, should work. However, I don't think I can add a test without:

"# if you need some credentials for the Defect Dojo JIRA Cloud instance, contact one of the moderators"

@coheigea coheigea force-pushed the coheigea/jira-notes branch from 9bcd30d to e2fe8af Compare July 20, 2022 07:19
@coheigea
Copy link
Contributor Author

@Maffooch @damiencarol How can we move forward with getting this merged?

@Maffooch
Copy link
Contributor

@coheigea This totally slipped through the cracks. Sorry about that! I will add a test for this today.

@damiencarol damiencarol merged commit 6ca5896 into DefectDojo:dev Aug 15, 2022
@coheigea coheigea deleted the coheigea/jira-notes branch August 15, 2022 20:19
shipko pushed a commit to shipko/django-DefectDojo that referenced this pull request Sep 5, 2022
)

* Add all existing finding notes to the JIRA when created

* Add unittests for pushing existing notes to jira

Co-authored-by: Cody Maffucci <46459665+Maffooch@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants