self.cf_client = boto3.client('cloudformation')
self.cf_client_stubber = Stubber(self.cf_client)
print(f" cc {type(self.cf_client_stubber)}")
self.cf_client_stubber.add_response("describe_stacks", self.cf_describe_response,
self.cf_describe_params)
self.cf_client_stubber.activate()
stackList = self.cf_client_stubber.describe_stacks(StackName=self.cf_stack_name, NextToken='xyz')
whenever I run this method with pytest, I encounter the following error:
E AttributeError: 'Stubber' object has no attribute 'describe_stacks'
python/src/example.py:26: AttributeError
Any insight as to what the main problem would be?
I have found the solution to this problem.
add_reponse
. For example, if describe_stacks
is called before delete_stack
, then in the test add describe_stacks
before delete_stack
; otherwise, the methods will not be found.