great-vr-65723
03/17/2020, 4:09 AMaws.getCallerIdentity().accountId
I'm trying to find information on mock AWS providers for Pulumi. I found this PR, but zero additional documentation for how to use it. I also can't find much information about tests beyond this blog post that is very cursory.
Anyway, does anyone have any information about how to mock the AWS provider? Spefically the getCallerIdentity()
function?white-balloon-205
03/17/2020, 5:13 AMgreat-vr-65723
03/23/2020, 3:56 AMcall
Mock.
From the type definition I see:
* @param token: The token that indicates which function is being called. This token is of the form "package:module:function".
And I have a mock like:
pulumi.runtime.setMocks({
call(token: string, args: any, provider?: string): any {
if (token === "aws:iam:getPolicyDocument") {
return {args};
}
},
newResource(type: string, name: string, inputs: any, provider?: string, id?: string): any {
return undefined
}
});
But I'm not sure if I'm setting the token correctly. The type definition says `
call mocks provider-implemented function calls (e.g. aws.get_availability_zones).
But that doesn't seem to match the format in the @param
statement.Mock
requires both call
and newResource
to be set, even though I'm not using newResource
for my test.call
Mock they can point me to, especially a TypeScript one?