File tree Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Expand file tree Collapse file tree 3 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ def update_or_create_dependency(
249
249
def update_or_create_license_detection (
250
250
project ,
251
251
detection_data ,
252
- resource_path ,
252
+ resource_path = None ,
253
253
from_package = False ,
254
254
):
255
255
"""
@@ -277,6 +277,14 @@ def update_or_create_license_detection(
277
277
detection_data ,
278
278
)
279
279
280
+ if not license_detection :
281
+ project .add_error (
282
+ model = "update_or_create_license_detection" ,
283
+ details = detection_data ,
284
+ resource = resource_path ,
285
+ )
286
+ return
287
+
280
288
if resource_path :
281
289
file_region = scancode .get_file_region (
282
290
detection_data = detection_data ,
@@ -290,8 +298,8 @@ def update_or_create_license_detection(
290
298
291
299
def _clean_license_detection_data (detection_data ):
292
300
detection_data = detection_data .copy ()
293
- if "sample_matches " in detection_data :
294
- matches = detection_data .pop ("sample_matches " )
301
+ if "reference_matches " in detection_data :
302
+ matches = detection_data .pop ("reference_matches " )
295
303
detection_data ["matches" ] = matches
296
304
return detection_data
297
305
Original file line number Diff line number Diff line change @@ -168,6 +168,7 @@ def test_scanpipe_project_model_delete_related_objects(self):
168
168
"scanpipe.CodebaseRelation" : 0 ,
169
169
"scanpipe.CodebaseResource" : 1 ,
170
170
"scanpipe.DiscoveredDependency" : 0 ,
171
+ "scanpipe.DiscoveredLicense" : 0 ,
171
172
"scanpipe.DiscoveredPackage" : 1 ,
172
173
"scanpipe.DiscoveredPackage_codebase_resources" : 1 ,
173
174
"scanpipe.ProjectMessage" : 0 ,
Original file line number Diff line number Diff line change @@ -683,7 +683,7 @@ def test_scanpipe_views_project_views(self):
683
683
with self .assertNumQueries (8 ):
684
684
self .client .get (url )
685
685
686
- with self .assertNumQueries (13 ):
686
+ with self .assertNumQueries (14 ):
687
687
self .client .get (self .project1 .get_absolute_url ())
688
688
689
689
@mock .patch ("scanpipe.models.Run.execute_task_async" )
You can’t perform that action at this time.
0 commit comments