@@ -923,3 +923,56 @@ def test_events_messages(self, mock):
923923 "url_ui" : "http://localhost:8080/finding/235" ,
924924 }],
925925 })
926+
927+ with self .subTest ("scan_added problematic titles" ):
928+ BaseImporter (
929+ environment = Development_Environment .objects .get_or_create (name = "Development" )[0 ],
930+ scan_type = "ZAP Scan" ,
931+ ).notify_scan_added (
932+ test ,
933+ updated_count = 4 ,
934+ new_findings = [
935+ Finding .objects .create (test = test , title = "Colon: New Finding" , severity = "Critical" ),
936+ ],
937+ findings_mitigated = [
938+ Finding .objects .create (test = test , title = "[Brackets] Mitigated Finding" , severity = "Medium" ),
939+ ],
940+ findings_reactivated = [
941+ Finding .objects .create (test = test , title = '"Quotation1" Reactivated Finding' , severity = "Low" ),
942+ ],
943+ findings_untouched = [
944+ Finding .objects .create (test = test , title = "'Quotation2' Untouched Finding" , severity = "Info" ),
945+ ],
946+ )
947+ self .assertEqual (mock .call_args .kwargs ["headers" ]["X-DefectDojo-Event" ], "scan_added" )
948+ self .maxDiff = None
949+ self .assertEqual (mock .call_args .kwargs ["json" ]["findings" ], {
950+ "new" : [{
951+ "id" : 232 ,
952+ "title" : "New Finding" ,
953+ "severity" : "Critical" ,
954+ "url_api" : "http://localhost:8080/api/v2/findings/232/" ,
955+ "url_ui" : "http://localhost:8080/finding/232" ,
956+ }],
957+ "mitigated" : [{
958+ "id" : 233 ,
959+ "title" : "Mitigated Finding" ,
960+ "severity" : "Medium" ,
961+ "url_api" : "http://localhost:8080/api/v2/findings/233/" ,
962+ "url_ui" : "http://localhost:8080/finding/233" ,
963+ }],
964+ "reactivated" : [{
965+ "id" : 234 ,
966+ "title" : "Reactivated Finding" ,
967+ "severity" : "Low" ,
968+ "url_api" : "http://localhost:8080/api/v2/findings/234/" ,
969+ "url_ui" : "http://localhost:8080/finding/234" ,
970+ }],
971+ "untouched" : [{
972+ "id" : 235 ,
973+ "title" : "Untouched Finding" ,
974+ "severity" : "Info" ,
975+ "url_api" : "http://localhost:8080/api/v2/findings/235/" ,
976+ "url_ui" : "http://localhost:8080/finding/235" ,
977+ }],
978+ })
0 commit comments