Skip to content

Commit

Permalink
fix(sca): Revert "feat(sca): using the new api license/get-licenses-v…
Browse files Browse the repository at this point in the history
…iolations … (#6176)

Revert "feat(sca): using the new api license/get-licenses-violations instead of packages/get-licenses-violations (which is deprecated) (#6174)"

This reverts commit de1f669.

Co-authored-by: ipeleg <ipeleg@paloaltonetworks.com>
  • Loading branch information
itai1357 and ipeleg committed Apr 16, 2024
1 parent 5520331 commit db6f7fe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions checkov/common/sca/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ def get_license_statuses(packages: list[dict[str, Any]]) -> list[_LicenseStatus]
try:
response = request_wrapper(
method="POST",
url=f"{bc_integration.api_url}/api/v1/vulnerabilities/license/get-licenses-violations",
url=f"{bc_integration.api_url}/api/v1/vulnerabilities/packages/get-licenses-violations",
headers=bc_integration.get_default_headers("POST"),
json={"packages": requests_input},
should_call_raise_for_status=True
Expand All @@ -694,7 +694,7 @@ async def get_license_statuses_async(
as an input, and the asyncio behavior is managed in the calling method.
"""
requests_input = _get_request_input(packages)
url = f"{bc_integration.api_url}/api/v1/vulnerabilities/license/get-licenses-violations"
url = f"{bc_integration.api_url}/api/v1/vulnerabilities/packages/get-licenses-violations"
if not requests_input:
return {'image_name': image_name, 'licenses': []}
try:
Expand Down
4 changes: 2 additions & 2 deletions tests/common/sca/test_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_licenses_status(mock_bc_integration):
# given
responses.add(
method=responses.POST,
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
json=response_json,
status=200
)
Expand Down Expand Up @@ -91,7 +91,7 @@ def test_licenses_status_on_failure(mock_bc_integration):

responses.add(
method=responses.POST,
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
status=500
)

Expand Down
2 changes: 1 addition & 1 deletion tests/sca_image/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def get_sca_image_report(mock_bc_integration: BcPlatformIntegration) -> Report:
}
responses.add(
method=responses.POST,
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
json=response_json,
status=200
)
Expand Down
8 changes: 4 additions & 4 deletions tests/sca_image/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_image_referencer_trigger_image_flow_calls(mock_bc_integration, image_na
}
with aioresponses() as mock_response:
mock_response.post(
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
payload=response_json,
status=200
)
Expand Down Expand Up @@ -94,7 +94,7 @@ def test_runner_honors_enforcement_rules(mock_bc_integration, image_name, cached

with aioresponses() as mock_response:
mock_response.post(
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
payload=response_json,
status=200
)
Expand Down Expand Up @@ -224,7 +224,7 @@ def test_run_license_policy(mock_bc_integration, image_name, cached_scan_result)
}
with aioresponses() as mock_response:
mock_response.post(
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
payload=response_json,
status=200
)
Expand Down Expand Up @@ -267,7 +267,7 @@ def test_run_with_empty_scan_result(mock_bc_integration):
}
responses.add(
method=responses.POST,
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/license/get-licenses-violations",
url=mock_bc_integration.api_url + "/api/v1/vulnerabilities/packages/get-licenses-violations",
json=response_json,
status=200
)
Expand Down

0 comments on commit db6f7fe

Please sign in to comment.