From eba97019a75858d5afbe371f5fce89b3804ea51c Mon Sep 17 00:00:00 2001 From: Nicolas Landais <nlandais@flexion.us> Date: Fri, 28 May 2021 00:59:30 -0400 Subject: [PATCH] Adding optional parameters to the set_test function (#50) * Pass tuple with file path and file content to the upload_scan function to fix issue with Nessus scan uploads. * Adding additional optional properties for the creation of a test * TODO -> Done * Adding new vars to the unittest and restoring the lost work done on the the create_test function * Remvong duplicate line * Adding function to add metadata to a product, removing create_product function and adding the ability to add custom headers to the requests * Since metadata can be applied to multiple objects, renaming the function to be more specific as to what object metadate is being applied * Capturing enhancements to the DefectDojo API (v2) Python wrapper * Adding title, description and version to the wrapper used to modify a test * using the proper verb * Fixing merge conflicts take #2 * Re-implementing change that had been left in the shuffle when resolving conflicts on the last PR merge --- defectdojo_api/defectdojo_apiv2.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/defectdojo_api/defectdojo_apiv2.py b/defectdojo_api/defectdojo_apiv2.py index 6869850..f8edffa 100644 --- a/defectdojo_api/defectdojo_apiv2.py +++ b/defectdojo_api/defectdojo_apiv2.py @@ -496,8 +496,9 @@ class DefectDojoAPIv2(object): return self._request('POST', 'tests/', data=data) - def set_test(self, test_id, engagement_id=None, test_type=None, environment=None, - target_start=None, target_end=None, percent_complete=None): + def set_test(self, test_id, engagement_id=None, test_type=None, + environment=None, target_start=None, target_end=None, + percent_complete=None, , title=None, version=None, description=None): """Creates a product with the given properties. :param engagement_id: Engagement id. @@ -505,6 +506,10 @@ class DefectDojoAPIv2(object): :param target_start: Test start date. :param target_end: Test end date. :param percent_complete: Percentage until test completion. + :param title: Test title/name + :param version: Test version + :param description: Test description + """ @@ -532,6 +537,15 @@ class DefectDojoAPIv2(object): if percent_complete: data['percent_complete'] = percent_complete + + if title: + data['title'] = title + + if version: + data['version'] = version + + if description: + data['description'] = description return self._request('PUT', 'tests/' + str(test_id) + '/', data=data) -- GitLab