コード例 #1
0
ファイル: gplus_test.go プロジェクト: samthor/storable
func TestZeroUser(t *testing.T) {
	ud := &UserData{}
	err := storable.Get(nil, ud)
	if err != storable.ErrNoKey {
		t.Errorf("expected no key, got err=%s", err)
	}
}
コード例 #2
0
ファイル: gplus_test.go プロジェクト: samthor/storable
func TestInvalidUser(t *testing.T) {
	c, err := aetest.NewContext(nil)
	if err != nil {
		t.Fatal(err)
	}

	ud := &UserData{
		User: "******",
	}
	err = storable.Get(c, ud)
	if err != storable.ErrNotFound {
		t.Errorf("expected not found, got err=%s", err)
	}
}
コード例 #3
0
ファイル: gplus_test.go プロジェクト: samthor/storable
func TestGPlusUser(t *testing.T) {
	c, err := aetest.NewContext(nil)
	if err != nil {
		t.Fatal(err)
	}

	ud := &UserData{
		User: "******", // +SamThorogood
	}
	err = storable.Get(c, ud)
	if err != nil {
		t.Errorf("expected get success, got err=%s", err)
	}
	if ud.ETag == "" || ud.Updated.IsZero() {
		t.Errorf("expected valid user, got %+v", ud)
	}
	t.Logf("got user: %v", ud.DisplayName)
}
コード例 #4
0
ファイル: game.go プロジェクト: samthor/storable
// NewGameFactory returns a GameFactory for this appengine.Context.
func NewGameFactory(c appengine.Context) GameFactory {
	return func(id string) (*Game, error) {
		g := &Game{ID: id}
		return g, storable.Get(c, g)
	}
}