I am testing a function whose very last line of code starts the execution of an AWS lambda. This part is not relevant to my test, so I want to mock the call to client.start_execution()
so that instead of actually triggering AWS it returns None.
Is there a way to use pytest mocks to simply replace the response of this function with a generic None?
2
Answers
A quick solution, if you do not need any specific logic, it to simply replace this function by a custom function. For example:
Assuming that the actual call you want to mock is from the Step Functions service, then you can utilize the moto library:
http://docs.getmoto.org/en/latest/docs/services/stepfunctions.html