func TestAuthGetSessionUnknownToken(t *testing.T) { auth, _ := buildAuth() token := auth.GenerateToken() user, err := auth.GetSession(token) test.AssertNotErr("Auth.GetSession", err, t) test.AssertNil("Auth.GetSession", user, t) }
func TestAuthGetSessionExpireSession(t *testing.T) { auth, _ := buildAuth() token := auth.GenerateToken() user := model.NewUser(token) err := auth.CreateSession(user) test.AssertNotErr("Auth.CreateSession", err, t) time.Sleep(time.Second) user, errGet := auth.GetSession(token) test.AssertNotErr("Auth.GetSession", errGet, t) test.AssertNil("Auth.GetSession", user, t) }