Skip to content

Commit 9f0b42a

Browse files
committed
Add unit tests
1 parent d012cd5 commit 9f0b42a

4 files changed

Lines changed: 4396 additions & 402 deletions

dojo/importers/default_reimporter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,8 @@ def process_findings(
359359
unsaved_finding,
360360
existing_finding,
361361
)
362+
# Findings that have already exist cannot be moved to into a group
363+
finding_will_be_grouped = False
362364
# Determine if we should skip the rest of the loop
363365
if force_continue:
364366
continue
@@ -373,8 +375,6 @@ def process_findings(
373375
unsaved_finding,
374376
self.user,
375377
)
376-
# Findings that have already exist cannot be moved to into a group
377-
finding_will_be_grouped = False
378378
else:
379379
finding, finding_will_be_grouped = self.process_finding_that_was_not_matched(unsaved_finding)
380380

unittests/test_jira_import_and_pushing_api.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,15 @@ def test_import_with_groups_with_push_to_jira_is_false_but_push_all(self):
185185
# by asserting full cassette is played we know issues have been updated in JIRA
186186
self.assert_cassette_played()
187187

188+
def test_import_with_group_by_with_push_all_but_no_groups_created(self):
189+
self.set_jira_push_all_issues(self.get_engagement(1))
190+
import0 = self.import_scan_with_params(self.zap_sample5_filename, group_by="component_name+component_version", verified=True)
191+
test_id = import0["test"]
192+
self.assert_jira_issue_count_in_test(test_id, 2)
193+
self.assert_jira_group_issue_count_in_test(test_id, 0)
194+
# by asserting full cassette is played we know issues have been updated in JIRA
195+
self.assert_cassette_played()
196+
188197
def test_import_no_push_to_jira_reimport_no_push_to_jira(self):
189198
import0 = self.import_scan_with_params(self.zap_sample5_filename, verified=True)
190199
test_id = import0["test"]

0 commit comments

Comments
 (0)