How to use the parliament.statement.expand_action function in parliament

To help you get started, we’ve selected a few parliament examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_exception_bad_expansion(self):
        try:
            expand_action("s3:zzz*")
            assert False
        except UnknownActionException as e:
            assert True
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_expand_action_with_permission_only_action(self):
        # There are 17 privileges list as "logs.CreateLogDelivery [permission only]"
        expanded_actions = expand_action("logs:GetLogDelivery")
        assert_count_equal(
            expanded_actions, [{"service": "logs", "action": "GetLogDelivery"}]
        )
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_expand_action_no_expansion(self):
        expanded_actions = expand_action("s3:listallmybuckets")
        assert_count_equal(
            expanded_actions, [{"service": "s3", "action": "ListAllMyBuckets"}]
        )
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_expand_action_with_expansion_for_prefix_used_multiple_times(self):
        expanded_actions = expand_action("ses:Describe*")
        assert_count_equal(
            expanded_actions,
            [
                {"service": "ses", "action": "DescribeActiveReceiptRuleSet"},
                {"service": "ses", "action": "DescribeConfigurationSet"},
                {"service": "ses", "action": "DescribeReceiptRule"},
                {"service": "ses", "action": "DescribeReceiptRuleSet"},
            ],
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_expand_action_with_casing(self):
        expanded_actions = expand_action("iAm:li*sTuS*rs")
        assert_count_equal(
            expanded_actions, [{"service": "iam", "action": "ListUsers"}]
        )
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_exception_bad_service(self):
        try:
            expand_action("333:listallmybuckets")
            assert False
        except UnknownPrefixException as e:
            assert True
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_expand_action_with_expansion(self):
        expanded_actions = expand_action("s3:listallmybucke*")
        assert_count_equal(
            expanded_actions, [{"service": "s3", "action": "ListAllMyBuckets"}]
        )
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_exception_bad_action(self):
        try:
            expand_action("s3:zzz")
            assert False
        except UnknownActionException as e:
            assert True
github duo-labs / parliament / tests / unit / test_action_expansion.py View on Github external
def test_exception_malformed(self):
        try:
            expand_action("malformed")
            assert False
        except ValueError as e:
            assert True