Fixed tests by deterministically mocking session. Issue: #415