I have a Python method called Pippo
that during its execution it calls other methods which return the Dataframes to be processed.
I want to mock every single method return with a custom Dataframe, but I can not understand how to patch them automatically.
Example:
module1.py
import module2
import module3
def Pippo():
returnPluto = module2.Pluto() <---- Wanna mock this Dataframe
....
....
....
returnPaperino = module3.Paperino() <---- Wanna mock this Dataframe
Pluto()
In the flow of the Pippo
method I call Pluto
and Paperino
method of another module.
How can I indicate in my testClass when I test Pippo that the method to be called is the one with the mocked Dataframe?
I use Python 2.7 with Cassandra.
For the test I use unittest.