ticket:5 Added tests for auth, fixed auth