With a quick look, it looks like the level of ridicule is getting big. If you are in a dynamic language (I assume that yes, since your example is in Python), I would try to build either subclasses of production classes with the most problematic methods, overridden and representing bullying data, so that you would get a mix of production and mock above the code. If your path to the code does not allow you to instantiate objects, I would try the monkey patch in the replacement methods that return the data layout.
Weather or not, this is the smell of code, also depends on the quality of the mocking data. Getting into the debugger and copying the known correct data into it or sniffing it from the network, my experience is the preferred way to ensure this.
Integration versus unit testing is also an economical question: how hard is it to replace unit tests with integration / functional tests? The larger the scale of your system, the more you can get with a mockery and, therefore, unit tests.
Jacob Oscarson
source share