I am using unittest.mock to test my Django application.
The set-up is the following:
- I want to test a function
foo foouses a methodXwhich is a constructor from an external packageXis called infoowith some parametersargsAto return an objectxx.create_datasetis called infoowith some parametersargsBto return an objectdsds.loadis called infoowith some parametersargsCto store data inds.datads.datais manipulated (merge, agg...) infooto create the return value offoo
I want to test that the function foo works as expected, knowing the return values of the other functions calls given argsA, argsB, argsC.
At the moment, I can't even run my test as I have a TypeError when ds.data is being manipulated : TypeError: expected pandas DataFrame or Series, got 'MagicMock'