Mock object in tests

Mock object in tests, replace some static functions in Session class