import os
import unittest

from checkov.serverless.checks.function.aws.AdminPolicyDocument import check
from checkov.serverless.runner import Runner
from checkov.runner_filter import RunnerFilter

class TestAdminPolicyDocument(unittest.TestCase):

    def test_summary(self):
        runner = Runner()
        current_dir = os.path.dirname(os.path.realpath(__file__))

        # Used in
        os.environ["sneaky_var"] = "*"

        test_files_dir = current_dir + "/example_AdminPolicyDocument"
        report = runner.run(root_folder=test_files_dir, runner_filter=RunnerFilter(checks=[check.id]))
        summary = report.get_summary()

        self.assertEqual(summary['passed'], 2,
                         f"Passed checks: {[fc.file_path for fc in report.passed_checks]}")
        self.assertEqual(summary['failed'], 6,
                         f"Failed checks: {[fc.file_path for fc in report.failed_checks]}")
        self.assertEqual(summary['skipped'], 0,
                         f"Skipped checks: {[fc.file_path for fc in report.skipped_checks]}")
        self.assertEqual(summary['parsing_errors'], 0)


if __name__ == '__main__':
    unittest.main()

[((31, 4, 31, 19), 'unittest.main', 'unittest.main', ({}, {}), '()', False, 'import unittest\n'), ((11, 17, 11, 25), 'checkov.serverless.runner.Runner', 'Runner', ({}, {}), '()', False, 'from checkov.serverless.runner import Runner\n'), ((12, 38, 12, 64), 'os.path.realpath', 'os.path.realpath', ({(12, 55, 12, 63): '__file__'}, {}), '(__file__)', False, 'import os\n'), ((18, 70, 18, 101), 'checkov.runner_filter.RunnerFilter', 'RunnerFilter', (), '', False, 'from checkov.runner_filter import RunnerFilter\n')]