Skip to content

[Enhancement] Unit test shoud support invoking a rule that has an argument #333

Open
@fabiodouek

Description

@fabiodouek

Is your feature request related to a problem? Please describe.

I'm creating cfn-guard rules for evaluating Resource Policies. I will use these rules from different entry points: CloudFormation and AWS Config. This means that the extraction path from these two use cases will be different.
However the Resource policy evaluation on the statements will be the exact same.
For this reason I've created rules with arguments to evaluate the policy.

However, I'm not able to do unit tests on rules that expect an argument.

Describe the solution you'd like

In the unit test file, I would like to be able to specify the argument, where this will be the value in the input. A nice feature would be if we could specify the extraction path such as $this/PolicyDocument

expectations:
rules:
check_principal_deny($this)

Describe alternatives you've considered

The alternative at the moment is to have tests duplicated from different extraction points, which makes hard to unit test and maintain it

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions