Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(470)

Side by Side Diff: impl/memory/datastore_test.go

Issue 1929423002: filter/txnBuf: Use fully-qualified App ID. (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/gae@master
Patch Set: Use public methods for defining Info service in tests. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « impl/memory/datastore.go ('k') | impl/memory/info.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "testing" 9 "testing"
10 "time" 10 "time"
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 m.Time = time.Now().UTC() 678 m.Time = time.Now().UTC()
679 So(ds.Get(&m), ShouldBeNil) 679 So(ds.Get(&m), ShouldBeNil)
680 So(m.Time.IsZero(), ShouldBeTrue) 680 So(m.Time.IsZero(), ShouldBeTrue)
681 }) 681 })
682 } 682 }
683 683
684 func TestNewDatastore(t *testing.T) { 684 func TestNewDatastore(t *testing.T) {
685 t.Parallel() 685 t.Parallel()
686 686
687 Convey("Can get and use a NewDatastore", t, func() { 687 Convey("Can get and use a NewDatastore", t, func() {
688 » » ds, err := NewDatastore("aid", "ns") 688 » » c := UseWithAppID(context.Background(), "dev~aid")
689 » » So(err, ShouldBeNil) 689 » » c = infoS.Get(c).MustNamespace("ns")
690 » » ds := NewDatastore(infoS.Get(c))
690 691
691 k := ds.MakeKey("Something", 1) 692 k := ds.MakeKey("Something", 1)
692 » » So(k.AppID(), ShouldEqual, "aid") 693 » » So(k.AppID(), ShouldEqual, "dev~aid")
693 So(k.Namespace(), ShouldEqual, "ns") 694 So(k.Namespace(), ShouldEqual, "ns")
694 695
695 type Model struct { 696 type Model struct {
696 ID int64 `gae:"$id"` 697 ID int64 `gae:"$id"`
697 Value []int64 698 Value []int64
698 } 699 }
699 So(ds.Put(&Model{ID: 1, Value: []int64{20, 30}}), ShouldBeNil) 700 So(ds.Put(&Model{ID: 1, Value: []int64{20, 30}}), ShouldBeNil)
700 701
701 vals := []dsS.PropertyMap{} 702 vals := []dsS.PropertyMap{}
702 So(ds.GetAll(dsS.NewQuery("Model").Project("Value"), &vals), Sho uldBeNil) 703 So(ds.GetAll(dsS.NewQuery("Model").Project("Value"), &vals), Sho uldBeNil)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Add "foos" to a new namespace, then confirm that it g ets indexed. 756 // Add "foos" to a new namespace, then confirm that it g ets indexed.
756 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti (foos), ShouldBeNil) 757 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti (foos), ShouldBeNil)
757 dsS.Get(ctx).Testable().CatchupIndexes() 758 dsS.Get(ctx).Testable().CatchupIndexes()
758 759
759 results = nil 760 results = nil
760 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q , &results), ShouldBeNil) 761 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q , &results), ShouldBeNil)
761 So(len(results), ShouldEqual, 2) 762 So(len(results), ShouldEqual, 2)
762 }) 763 })
763 }) 764 })
764 } 765 }
OLDNEW
« no previous file with comments | « impl/memory/datastore.go ('k') | impl/memory/info.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698