@@ -127,57 +127,57 @@ def import_reimport_performance(self, expected_num_queries1, expected_num_async_
127127 importer = DefaultImporter (** import_options )
128128 test , _ , _len_new_findings , _len_closed_findings , _ , _ , _ = importer .process_scan (scan )
129129
130- # # use reimport with the full report so it add a finding and some endpoints
131- # with (
132- # self.subTest("reimport1"), impersonate(Dojo_User.objects.get(username="admin")),
133- # self.assertNumQueries(expected_num_queries2),
134- # self.assertNumAsyncTask(expected_num_async_tasks2),
135- # STACK_HAWK_FILENAME.open(encoding="utf-8") as scan,
136- # ):
137- # reimport_options = {
138- # "test": test,
139- # "user": lead,
140- # "lead": lead,
141- # "scan_date": None,
142- # "minimum_severity": "Info",
143- # "active": True,
144- # "verified": True,
145- # "sync": True,
146- # "scan_type": STACK_HAWK_SCAN_TYPE,
147- # "tags": ["performance-test-reimport", "reimport-tag-in-param", "reimport-go-faster"],
148- # "apply_tags_to_findings": True,
149- # }
150- # reimporter = DefaultReImporter(**reimport_options)
151- # test, _, _len_new_findings, _len_closed_findings, _, _, _ = reimporter.process_scan(scan)
152-
153- # # use reimport with the subset again to close a finding and mitigate some endpoints
154- # with (
155- # self.subTest("reimport2"), impersonate(Dojo_User.objects.get(username="admin")),
156- # self.assertNumQueries(expected_num_queries3),
157- # self.assertNumAsyncTask(expected_num_async_tasks3),
158- # STACK_HAWK_SUBSET_FILENAME.open(encoding="utf-8") as scan,
159- # ):
160- # reimport_options = {
161- # "test": test,
162- # "user": lead,
163- # "lead": lead,
164- # "scan_date": None,
165- # "minimum_severity": "Info",
166- # "active": True,
167- # "verified": True,
168- # "sync": True,
169- # "scan_type": STACK_HAWK_SCAN_TYPE,
170- # }
171- # reimporter = DefaultReImporter(**reimport_options)
172- # test, _, _len_new_findings, _len_closed_findings, _, _, _ = reimporter.process_scan(scan)
130+ # use reimport with the full report so it add a finding and some endpoints
131+ with (
132+ self .subTest ("reimport1" ), impersonate (Dojo_User .objects .get (username = "admin" )),
133+ self .assertNumQueries (expected_num_queries2 ),
134+ self .assertNumAsyncTask (expected_num_async_tasks2 ),
135+ STACK_HAWK_FILENAME .open (encoding = "utf-8" ) as scan ,
136+ ):
137+ reimport_options = {
138+ "test" : test ,
139+ "user" : lead ,
140+ "lead" : lead ,
141+ "scan_date" : None ,
142+ "minimum_severity" : "Info" ,
143+ "active" : True ,
144+ "verified" : True ,
145+ "sync" : True ,
146+ "scan_type" : STACK_HAWK_SCAN_TYPE ,
147+ "tags" : ["performance-test-reimport" , "reimport-tag-in-param" , "reimport-go-faster" ],
148+ "apply_tags_to_findings" : True ,
149+ }
150+ reimporter = DefaultReImporter (** reimport_options )
151+ test , _ , _len_new_findings , _len_closed_findings , _ , _ , _ = reimporter .process_scan (scan )
152+
153+ # use reimport with the subset again to close a finding and mitigate some endpoints
154+ with (
155+ self .subTest ("reimport2" ), impersonate (Dojo_User .objects .get (username = "admin" )),
156+ self .assertNumQueries (expected_num_queries3 ),
157+ self .assertNumAsyncTask (expected_num_async_tasks3 ),
158+ STACK_HAWK_SUBSET_FILENAME .open (encoding = "utf-8" ) as scan ,
159+ ):
160+ reimport_options = {
161+ "test" : test ,
162+ "user" : lead ,
163+ "lead" : lead ,
164+ "scan_date" : None ,
165+ "minimum_severity" : "Info" ,
166+ "active" : True ,
167+ "verified" : True ,
168+ "sync" : True ,
169+ "scan_type" : STACK_HAWK_SCAN_TYPE ,
170+ }
171+ reimporter = DefaultReImporter (** reimport_options )
172+ test , _ , _len_new_findings , _len_closed_findings , _ , _ , _ = reimporter .process_scan (scan )
173173
174174 # patch the we_want_async decorator to always return True so we don't depend on block_execution flag shenanigans
175175 # @patch("dojo.decorators.we_want_async", return_value=True)
176176 # def test_import_reimport_reimport_performance_async(self, mock):
177177 def test_import_reimport_reimport_performance_async (self ):
178178 self .import_reimport_performance (
179- expected_num_queries1 = 682 ,
180- expected_num_async_tasks1 = 10 ,
179+ expected_num_queries1 = 684 ,
180+ expected_num_async_tasks1 = 11 ,
181181 expected_num_queries2 = 610 ,
182182 expected_num_async_tasks2 = 22 ,
183183 expected_num_queries3 = 292 ,
@@ -198,8 +198,8 @@ def test_import_reimport_reimport_performance_no_async(self):
198198 testuser .usercontactinfo .block_execution = True
199199 testuser .usercontactinfo .save ()
200200 self .import_reimport_performance (
201- expected_num_queries1 = 682 ,
202- expected_num_async_tasks1 = 10 ,
201+ expected_num_queries1 = 683 ,
202+ expected_num_async_tasks1 = 11 ,
203203 expected_num_queries2 = 615 ,
204204 expected_num_async_tasks2 = 22 ,
205205 expected_num_queries3 = 297 ,
@@ -222,8 +222,8 @@ def test_import_reimport_reimport_performance_no_async_with_product_grading(self
222222 self .system_settings (enable_product_grade = True )
223223
224224 self .import_reimport_performance (
225- expected_num_queries1 = 702 ,
226- expected_num_async_tasks1 = 15 ,
225+ expected_num_queries1 = 687 ,
226+ expected_num_async_tasks1 = 11 ,
227227 expected_num_queries2 = 645 ,
228228 expected_num_async_tasks2 = 28 ,
229229 expected_num_queries3 = 322 ,
0 commit comments