func TestOAuthStoreSaveAuthData(t *testing.T) { Setup() a1 := model.AuthData{} a1.ClientId = model.NewId() a1.UserId = model.NewId() a1.Code = model.NewId() if err := (<-store.OAuth().SaveAuthData(&a1)).Err; err != nil { t.Fatal(err) } }
func TestOAuthStoreRemoveAuthDataByUser(t *testing.T) { Setup() a1 := model.AuthData{} a1.ClientId = model.NewId() a1.UserId = model.NewId() a1.Code = model.NewId() Must(store.OAuth().SaveAuthData(&a1)) if err := (<-store.OAuth().PermanentDeleteAuthDataByUser(a1.UserId)).Err; err != nil { t.Fatal(err) } }
func TestOAuthStoreRemoveAuthData(t *testing.T) { Setup() a1 := model.AuthData{} a1.ClientId = model.NewId() a1.UserId = model.NewId() a1.Code = model.NewId() Must(store.OAuth().SaveAuthData(&a1)) if err := (<-store.OAuth().RemoveAuthData(a1.Code)).Err; err != nil { t.Fatal(err) } if err := (<-store.OAuth().GetAuthData(a1.Code)).Err; err == nil { t.Fatal("should have errored - auth code removed") } }