mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-05 03:12:14 +00:00
resolve comments
This commit is contained in:
+1
-9
@@ -1,7 +1,6 @@
|
||||
import typer
|
||||
|
||||
from prowler.config.config import available_compliance_frameworks
|
||||
from prowler.lib.banner import print_banner
|
||||
from prowler.lib.check.check import (
|
||||
bulk_load_checks_metadata,
|
||||
bulk_load_compliance_frameworks,
|
||||
@@ -41,6 +40,7 @@ def list_resources(provider: str, resource_type: str):
|
||||
print_compliance_frameworks(bulk_load_compliance_frameworks(provider))
|
||||
elif resource_type in ["checks", "checks-json"]:
|
||||
bulk_checks_metadata = bulk_load_checks_metadata(provider)
|
||||
# TODO fill the rest of the arguments
|
||||
checks_to_execute = load_checks_to_execute(
|
||||
bulk_checks_metadata,
|
||||
bulk_load_compliance_frameworks(provider),
|
||||
@@ -141,13 +141,5 @@ create_list_commands(gcp)
|
||||
create_list_commands(kubernetes)
|
||||
|
||||
|
||||
@app.command("banner", help="Prints the banner of the tool.")
|
||||
def banner(show: bool = True):
|
||||
if show:
|
||||
print_banner(show)
|
||||
else:
|
||||
print("Banner is not shown.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app()
|
||||
|
||||
+6
-15
@@ -6,15 +6,6 @@ runner = CliRunner()
|
||||
|
||||
|
||||
class TestCLI:
|
||||
def test_banner_show(self):
|
||||
result = runner.invoke(app, ["banner", "--show"])
|
||||
assert result.exit_code == 0
|
||||
assert "Banner is not shown." not in result.output
|
||||
|
||||
def test_banner_no_show(self):
|
||||
result = runner.invoke(app, ["banner", "--no-show"])
|
||||
assert result.exit_code == 0
|
||||
assert "Banner is not shown." in result.output
|
||||
|
||||
def test_list_services_aws(self):
|
||||
result = runner.invoke(app, ["aws", "list-services"])
|
||||
@@ -31,12 +22,12 @@ class TestCLI:
|
||||
assert result.exit_code == 0
|
||||
assert "available categories." in result.output
|
||||
|
||||
def test_list_compliance_aws():
|
||||
def test_list_compliance_aws(self):
|
||||
result = runner.invoke(app, ["aws", "list-compliance"])
|
||||
assert result.exit_code == 0
|
||||
assert "available Compliance Frameworks." in result.output
|
||||
|
||||
def test_list_compliance_requirements_aws():
|
||||
def test_list_compliance_requirements_aws(self):
|
||||
result = runner.invoke(
|
||||
app, ["aws", "list-compliance-requirements", "cis_2.0_aws", "soc2_aws"]
|
||||
)
|
||||
@@ -44,12 +35,12 @@ class TestCLI:
|
||||
assert "Listing CIS 2.0 AWS Compliance Requirements:" in result.output
|
||||
assert "Listing SOC2 AWS Compliance Requirements:" in result.output
|
||||
|
||||
def test_list_compliance_requirements_no_compliance_aws():
|
||||
def test_list_compliance_requirements_no_compliance_aws(self):
|
||||
result = runner.invoke(app, ["aws", "list-compliance-requirements"])
|
||||
assert result.exit_code == 2
|
||||
assert "Expected at least one" in result.output
|
||||
|
||||
def test_list_compliance_requirements_one_invalid_aws():
|
||||
def test_list_compliance_requirements_one_invalid_aws(self):
|
||||
invalid_name = "invalid"
|
||||
result = runner.invoke(
|
||||
app, ["aws", "list-compliance-requirements", "cis_2.0_aws", invalid_name]
|
||||
@@ -58,12 +49,12 @@ class TestCLI:
|
||||
assert "Listing CIS 2.0 AWS Compliance Requirements:" in result.output
|
||||
assert f"{invalid_name} is not a valid Compliance Framework" in result.output
|
||||
|
||||
def test_list_checks_aws():
|
||||
def test_list_checks_aws(self):
|
||||
result = runner.invoke(app, ["aws", "list-checks"])
|
||||
assert result.exit_code == 0
|
||||
assert "available checks." in result.output
|
||||
|
||||
def test_list_checks_json_aws():
|
||||
def test_list_checks_json_aws(self):
|
||||
result = runner.invoke(app, ["aws", "list-checks-json"])
|
||||
assert result.exit_code == 0
|
||||
assert "aws" in result.output
|
||||
|
||||
Reference in New Issue
Block a user