Example #1
0
    def run(self, root_folder=None, external_checks_dir=None, files=None,
            runner_filter=RunnerFilter(), collect_skip_comments=True):
        self.prepare_data()

        report = super().run(root_folder=self.gitlab.gitlab_conf_dir_path, external_checks_dir=external_checks_dir,
                             files=files,
                             runner_filter=runner_filter, collect_skip_comments=collect_skip_comments)
        JsonRunner._change_files_path_to_relative(report)
        return report
Example #2
0
 def test_runner_complex_passing_check(self):
     current_dir = os.path.dirname(os.path.realpath(__file__))
     valid_dir_path = os.path.join(current_dir, "resources", "complex", "pass")
     checks_dir = os.path.join(current_dir, "checks", "complex")
     runner = Runner()
     report = runner.run(
         root_folder=valid_dir_path,
         external_checks_dir=[checks_dir],
         runner_filter=RunnerFilter(framework="all", checks=["CKV_COMPLEX_1"]),
     )
     self.assertEqual(len(report.passed_checks), 1)
     self.assertEqual(report.parsing_errors, [])
     self.assertEqual(report.failed_checks, [])
     self.assertEqual(report.skipped_checks, [])
     report.print_console()
Example #3
0
 def test_runner_array_failing_check(self):
     current_dir = os.path.dirname(os.path.realpath(__file__))
     valid_dir_path = os.path.join(current_dir, "resources", "array", "fail")
     checks_dir = os.path.join(current_dir, "checks", "array")
     runner = Runner()
     report = runner.run(
         root_folder=valid_dir_path,
         external_checks_dir=[checks_dir],
         runner_filter=RunnerFilter(framework='all', checks=["CKV_BARBAZ_1"])
     )
     self.assertEqual(len(report.failed_checks), 2)
     self.assertEqual(report.parsing_errors, [])
     self.assertEqual(report.passed_checks, [])
     self.assertEqual(report.skipped_checks, [])
     report.print_console()