Reorganize session test to throw more useful errors during failure, and prevent shadowing self in the mocked method.