mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-10 11:51:29 +00:00
fix(iac): keep the clone error out of logs and responses
This commit is contained in:
2 files changed
+13
-4
No files matched your search
@@ -861,13 +861,19 @@ class TestIacProvider:
|
||||
lets the API report the failure as a normal task error instead of a
|
||||
`SystemExit` escaping the Celery worker.
|
||||
"""
|
||||
mock_clone.side_effect = Exception("repository not found")
|
||||
mock_clone.side_effect = Exception(
|
||||
"https://x-access-token:SENTINEL_TOKEN@github.com/user/repo.git refused"
|
||||
)
|
||||
|
||||
with pytest.raises(IacRepositoryCloneError) as exc_info:
|
||||
IacProvider(scan_repository_url="https://github.com/user/repo.git")
|
||||
|
||||
assert "repository not found" in str(exc_info.value)
|
||||
# ProwlerException formats original_exception into its str(), and the API
|
||||
# returns that, so the authenticated URL must not reach it
|
||||
assert "SENTINEL_TOKEN" not in str(exc_info.value)
|
||||
assert "Exception" in str(exc_info.value)
|
||||
assert exc_info.value.code == 21000
|
||||
assert isinstance(exc_info.value.__cause__, Exception)
|
||||
|
||||
def test_detect_branch_name_main(self):
|
||||
"""Test detecting 'main' branch from .git/HEAD"""
|
||||
|
||||
Reference in new issue
Block a user