Following the unit testing at <https://www.pulumi....
# python
Following the unit testing at and I am failing to understand how to Mock simple API calls. My IaC has
region = aws.get_region()
as one of the first API calls.
Copy code
class PulumiMocks(pulumi.runtime.Mocks):
    def new_resource(self, args: pulumi.runtime.MockResourceArgs):
        return [ + '_id', args.inputs]

    def call(self, args: pulumi.runtime.MockCallArgs):
        print(f"XXXXX call:")
        return {}
Narrowed down
invokes the Mocks
call(self, args: pulumi.runtime.MockCallArgs):
how do I extract that I am calling get_region() and return my Mock values? Maybe I’m missing something? I thought I would be able to add
method to the PulumiMocks() class? Any help would be appreciated.
the args.token member will be set to "aws:get_region" (I think, something like that at any rate), then you can just return a dictionary with the return values filled in, something like
{"name": "us-west-2"}