I managed to fix stack variables but now Im hittin...
# python
I managed to fix stack variables but now Im hitting another problem. I pulling up az list with function:
Copy code
# Get az's for region
azs = aws.get_availability_zones(state="available")
Now when I try to run test :
Copy code
File "/Users/unittests/infra.py", line 79, in <module>
    for num, az in enumerate(azs.zone_ids):
TypeError: 'NoneType' object is not iterable
in Pulumi documentation i found:
Copy code
call(token: string, args: any, provider?: undefined | string): Record<string, any>
call mocks provider-implemented function calls (e.g. aws.get_availability_zones).
But I have no idea how I can mock this call. For any code snippet I would be grateful
You’ll want the mock to return the same ‘shape’ as what the function actually returns. The
refers to the function being called. For example, if you look at https://github.com/pulumi/pulumi-aws/blob/master/sdk/python/pulumi_aws/acm/get_certificate.py#L103
You’ll see
Copy code
__ret__ = pulumi.runtime.invoke('aws:acm/getCertificate:getCertificate', __args__, opts=opts).value
is what
will be when you call
So typically, you’d just return
for most functions if you don’t care about doing anything with them in your tests. If you do, you can compare against
and then decide what relevant thing you want to return for your testing.