writing test for session and APIHandler