Netflix-Skunkworks/policyuniverse

Unit tests are missing some miscategorized actions

pbardon opened this issue · 0 comments

Checked out the master branch and tried to run the unit tests, got the following result:

$python --version
Python 3.9.1

$python -m pytest
============================= test session starts ==============================
platform linux -- Python 3.9.1, pytest-6.2.1, py-1.10.0, pluggy-0.13.1
rootdir: /home/bardon/workspace/policyuniverse
collected 32 items

policyuniverse/tests/test_action_categories.py F. [ 6%]
policyuniverse/tests/test_arn.py .. [ 12%]
policyuniverse/tests/test_expander_minimizer.py ............ [ 50%]
policyuniverse/tests/test_policy.py ....... [ 71%]
policyuniverse/tests/test_statement.py ...... [ 90%]
updater/test_service.py . [ 93%]
updater/test_service_action.py .. [100%]

=================================== FAILURES ===================================
________________ ActionGroupTestCase.test_actions_for_category _________________

self = <policyuniverse.tests.test_action_categories.ActionGroupTestCase testMethod=test_actions_for_category>

def test_actions_for_category(self):
    from policyuniverse.action_categories import actions_for_category

    read_only_actions = actions_for_category("Read")
    list_only_actions = actions_for_category("List")
    write_actions = actions_for_category("Write")
    permission_actions = actions_for_category("Permissions")

    for action in permission_actions:
        if action in {
            "iotsitewise:listaccesspolicies",
            "xray:getencryptionconfig",
            "imagebuilder:getcomponentpolicy",
            "imagebuilder:getimagepolicy",
            "imagebuilder:getimagerecipepolicy",
        }:  # miscategorized AWS actions
            continue
      self.assertFalse(":list" in action)

E AssertionError: True is not false

policyuniverse/tests/test_action_categories.py:58: AssertionError
=========================== short test summary info ============================
FAILED policyuniverse/tests/test_action_categories.py::ActionGroupTestCase::test_actions_for_category
========================= 1 failed, 31 passed in 2.37s =========================

I was able to fix the issue locally by adding some additional actions to the miscategorized actions list in the unit tests, I tried to create a PR but I did not have permissions to do so.