Пример #1
0
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)
	}
}
Пример #2
0
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)
	}
}
Пример #3
0
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")
	}
}