Thread
#python
    g

    gorgeous-minister-41131

    8 months ago
    Another related test/mocking q, since I think I found the workaround for the config.. I’m trying to create a resource, and when I run the test suite, it fails, but it works if I preview…
    File "/Users/tfarvour/.local/share/virtualenvs/pulumi-Miy8VggM/lib/python3.9/site-packages/pulumi_aws/iam/get_policy_document.py", line 414, in get_policy_document
        id=__ret__.id,
    AttributeError: 'NoneType' object has no attribute 'id'
    TL;DR: anyone have any guidance other than https://www.pulumi.com/blog/unit-test-infrastructure/ this for mocking the getter methods? I’m beginning to think that is the root of the issue here…
    This is the piece in question:
    iam_okta_policy_doc = pulumi_aws.iam.get_policy_document(
        statements=[
            pulumi_aws.iam.GetPolicyDocumentStatementArgs(
                sid="OktaSSOIAMUserAccountRoleLookup",
                actions=["iam:ListRoles", "iam:ListAccountAliases"],
                resources=["*"],
            )
        ],
    )
    is there a proper way to mock these get_ methods so that they dont’ bomb out on unittest?