If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
Whenever I want to unit test the post controller it fails in the init() method of the MyApp class because the session is not instantiated:
AttributeError: 'thread._local' object has no attribute 'session'
So what is the correct way of testing the controller/action? How should I mock the post handler object?
I come from the .NET world in which with IoC/DI, you can mock the dependency of the controller (the handler, in this case) and pass it to the controller/action as a parameter.
But in this case in which the handler is instantiated inside the controller/action, how can that be done? Or should I mock the session, request and response objects themselves?
Create your datamodels in modules