Skip to content

Commit e30f7f6

Browse files
samiat4911Tejas Saubhage
authored andcommitted
fix(sonarqube): handle missing service_key_1 in test_product_connection (DefectDojo#14412)
1 parent ebe082a commit e30f7f6

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

dojo/tools/api_sonarqube/api_client.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -496,9 +496,14 @@ def test_connection(self):
496496

497497
def test_product_connection(self, api_scan_configuration):
498498
organization = api_scan_configuration.service_key_2 or None
499-
project = self.get_project(
500-
api_scan_configuration.service_key_1, organization=organization,
501-
)
499+
if api_scan_configuration.service_key_1:
500+
project = self.get_project(
501+
api_scan_configuration.service_key_1, organization=organization,
502+
)
503+
else:
504+
project = self.find_project(
505+
api_scan_configuration.product.name, organization=organization,
506+
)
502507
project_name = project.get("name")
503508
message_prefix = "You have access to project"
504509
return (

0 commit comments

Comments
 (0)