Contrary to what one might expect, the MockSession class is pretty easy to understand.
MockSession is a subclass of the Sequence class and inherits most of its functionality from it.
There are some important differences, though:
-
The very first
MockSessioninstance created sets itself as the "active session" forsvnmock. The active session is theMockSessionobject that is used to validate incoming API function calls.If you need to change the active session, you can invoke the
make_active()method of the desiredMockSessioninstance. This method will make its invocant active, plus return the former active session. -
MockSessionoverridesSequence.__call__. Since it doesn't make sense forMockSessionobjects to be contained in other Containers,MockSession.__call__does not follow the Container protocol in this respect.