fix(config): path error in Windows environment (#1684)

Co-authored-by: sergargar <sergio@verica.io>
This commit is contained in:
Sergio Garcia
2023-01-10 17:06:14 +01:00
committed by GitHub
parent 50dd2e4179
commit 92cc2c8e69
4 changed files with 20 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
import os
import pathlib
from importlib.machinery import FileFinder
from pkgutil import ModuleInfo
@@ -107,7 +107,7 @@ class Test_Check:
test_cases = [
{
"input": {
"metadata_path": f"{os.path.dirname(os.path.realpath(__file__))}/fixtures/metadata.json",
"metadata_path": f"{pathlib.Path().absolute()}/tests/lib/check/fixtures/metadata.json",
},
"expected": {
"CheckID": "iam_disable_30_days_credentials",
@@ -129,7 +129,7 @@ class Test_Check:
test_cases = [
{
"input": {
"path": f"{os.path.dirname(os.path.realpath(__file__))}/fixtures/checklistA.json",
"path": f"{pathlib.Path().absolute()}/tests/lib/check/fixtures/checklistA.json",
"provider": "aws",
},
"expected": {"check11", "check12", "check7777"},
@@ -263,7 +263,7 @@ class Test_Check:
# }
# with mock.patch(
# "prowler.lib.check.check.compliance_specification_dir_path",
# new=f"{os.path.dirname(os.path.realpath(__file__))}/fixtures",
# new=f"{pathlib.Path().absolute()}/fixtures",
# ):
# provider = "aws"
# bulk_compliance_frameworks = bulk_load_compliance_frameworks(provider)
@@ -286,7 +286,7 @@ class Test_Check:
# }
# with mock.patch(
# "prowler.lib.check.check.compliance_specification_dir",
# new=f"{os.path.dirname(os.path.realpath(__file__))}/fixtures",
# new=f"{pathlib.Path().absolute()}/fixtures",
# ):
# provider = "aws"
# bulk_compliance_frameworks = bulk_load_compliance_frameworks(provider)
@@ -305,7 +305,7 @@ class Test_Check:
# }
# with mock.patch(
# "prowler.lib.check.check.compliance_specification_dir",
# new=f"{os.path.dirname(os.path.realpath(__file__))}/fixtures",
# new=f"{pathlib.Path().absolute()}/fixtures",
# ):
# provider = "aws"
# bulk_compliance_frameworks = bulk_load_compliance_frameworks(provider)

View File

@@ -1,4 +1,4 @@
import os
import pathlib
from os import path, remove
from unittest import mock
@@ -66,7 +66,7 @@ def mock_make_api_call(self, operation_name, kwarg):
class Test_Outputs:
def test_fill_file_descriptors(self):
audited_account = AWS_ACCOUNT_ID
output_directory = f"{os.path.dirname(os.path.realpath(__file__))}"
output_directory = f"{pathlib.Path().absolute()}"
audit_info = AWS_Audit_Info(
original_session=None,
audit_session=None,
@@ -334,7 +334,7 @@ class Test_Outputs:
# Create mock csv output file
fixtures_dir = "fixtures"
output_directory = (
f"{os.path.dirname(os.path.realpath(__file__))}/{fixtures_dir}"
f"{pathlib.Path().absolute()}/tests/lib/outputs/{fixtures_dir}"
)
output_mode = "csv"
filename = f"prowler-output-{input_audit_info.audited_account}"