refactor(parser): remove --only-logs option

This commit is contained in:
pedrooot committed 2024-09-12 11:02:05 +02:00
1 parent 7d1fad9eb7
commit 82e501fc08
12 files changed
+84 -170

No files matched your search

-21
View File
@@ -891,27 +891,6 @@ class TestCheck:
== f"\nCheck ID: {check.CheckID} - {Fore.MAGENTA}{check.ServiceName}{Fore.YELLOW} [{check.Severity}]{Style.RESET_ALL}\n"
)
def test_run_check_exception_only_logs(self, caplog):
caplog.set_level(ERROR)
findings = []
check = Mock()
check.CheckID = "test-check"
check.ServiceName = "test-service"
check.Severity = "test-severity"
error = Exception()
check.execute = Mock(side_effect=error)
with patch("prowler.lib.check.check.execute", return_value=findings):
assert run_check(check, only_logs=True) == findings
assert caplog.record_tuples == [
(
"root",
ERROR,
f"{check.CheckID} -- {error.__class__.__name__}[{traceback.extract_tb(error.__traceback__)[-1].lineno}]: {error}",
)
]
def test_run_check_exception(self, caplog, capsys):
caplog.set_level(ERROR)
-10
View File
@@ -56,7 +56,6 @@ class Test_Parser:
assert not parsed.unix_timestamp
assert parsed.log_level == "CRITICAL"
assert not parsed.log_file
assert not parsed.only_logs
assert not parsed.check
assert not parsed.checks_file
assert not parsed.checks_folder
@@ -104,7 +103,6 @@ class Test_Parser:
assert not parsed.unix_timestamp
assert parsed.log_level == "CRITICAL"
assert not parsed.log_file
assert not parsed.only_logs
assert not parsed.check
assert not parsed.checks_file
assert not parsed.checks_folder
@@ -144,7 +142,6 @@ class Test_Parser:
assert not parsed.unix_timestamp
assert parsed.log_level == "CRITICAL"
assert not parsed.log_file
assert not parsed.only_logs
assert not parsed.check
assert not parsed.checks_file
assert not parsed.checks_folder
@@ -179,7 +176,6 @@ class Test_Parser:
assert not parsed.unix_timestamp
assert parsed.log_level == "CRITICAL"
assert not parsed.log_file
assert not parsed.only_logs
assert not parsed.check
assert not parsed.checks_file
assert not parsed.checks_folder
@@ -365,12 +361,6 @@ class Test_Parser:
parsed = self.parser.parse(command)
assert parsed.unix_timestamp
def test_logging_parser_only_logs_set(self):
command = [prowler_command, "--only-logs"]
parsed = self.parser.parse(command)
assert parsed.only_logs
assert parsed.no_banner
def test_logging_parser_log_level_default(self):
log_level = "CRITICAL"
command = [prowler_command]
-2
View File
@@ -1048,7 +1048,6 @@ aws:
arguments.verbose = True
arguments.security_hub = True
arguments.shodan = "test-api-key"
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.send_sh_only_fails = True
@@ -1097,7 +1096,6 @@ aws:
arguments.output_filename = "output_test_filename"
arguments.security_hub = True
arguments.shodan = "test-api-key"
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.send_sh_only_fails = True
-1
View File
@@ -168,7 +168,6 @@ def set_default_provider_arguments(
arguments.output_formats = []
arguments.output_directory = ""
arguments.verbose = False
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.shodan = None
arguments.security_hub = False
@@ -225,7 +225,6 @@ class TestAzureProvider:
output_directory = arguments.output_directory
arguments.status = []
arguments.verbose = True
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.shodan = "test-api-key"
-2
View File
@@ -87,7 +87,6 @@ class TestGCPProvider:
arguments.output_formats = ["csv"]
arguments.output_directory = "output_test_directory"
arguments.verbose = True
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.shodan = "test-api-key"
@@ -180,7 +179,6 @@ class TestGCPProvider:
arguments.output_formats = ["csv"]
arguments.output_directory = "output_test_directory"
arguments.verbose = True
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.shodan = "test-api-key"
@@ -49,7 +49,6 @@ class TestKubernetesProvider:
arguments = Namespace()
arguments.kubeconfig_file = "dummy_path"
arguments.context = None
arguments.only_logs = False
arguments.namespace = None
audit_config = load_and_validate_config_file(
"kubernetes", default_config_file_path
@@ -84,7 +83,6 @@ class TestKubernetesProvider:
arguments = Namespace()
arguments.kubeconfig_file = "dummy_path"
arguments.context = None
arguments.only_logs = False
arguments.namespace = None
arguments.config_file = default_config_file_path
arguments.fixer_config = default_fixer_config_file_path
@@ -93,7 +91,6 @@ class TestKubernetesProvider:
arguments.output_directory = "output_test_directory"
arguments.verbose = True
arguments.output_filename = "output_test_filename"
arguments.only_logs = False
arguments.unix_timestamp = False
arguments.shodan = "test-api-key"