Added functionality to mock session values in tests

This patch allows one to set a session variable in a test case. Useful for bypassing authentication etc.