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

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: Go back to "dev~", too many things care. 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 := useGI(useGID(context.Background(), func(mod *globalInfoData ) {
689 » » So(err, ShouldBeNil) 689 » » » mod.appID = "aid"
690 » » » mod.fqAppID = "dev~aid"
691 » » }))
692 » » c = infoS.Get(c).MustNamespace("ns")
iannucci 2016/04/29 19:02:34 I don't think I like that packages other than 'mem
dnj 2016/04/29 19:08:07 Sure, done.
693 » » ds := NewDatastore(infoS.Get(c))
690 694
691 k := ds.MakeKey("Something", 1) 695 k := ds.MakeKey("Something", 1)
692 » » So(k.AppID(), ShouldEqual, "aid") 696 » » So(k.AppID(), ShouldEqual, "dev~aid")
693 So(k.Namespace(), ShouldEqual, "ns") 697 So(k.Namespace(), ShouldEqual, "ns")
694 698
695 type Model struct { 699 type Model struct {
696 ID int64 `gae:"$id"` 700 ID int64 `gae:"$id"`
697 Value []int64 701 Value []int64
698 } 702 }
699 So(ds.Put(&Model{ID: 1, Value: []int64{20, 30}}), ShouldBeNil) 703 So(ds.Put(&Model{ID: 1, Value: []int64{20, 30}}), ShouldBeNil)
700 704
701 vals := []dsS.PropertyMap{} 705 vals := []dsS.PropertyMap{}
702 So(ds.GetAll(dsS.NewQuery("Model").Project("Value"), &vals), Sho uldBeNil) 706 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. 759 // 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) 760 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).PutMulti (foos), ShouldBeNil)
757 dsS.Get(ctx).Testable().CatchupIndexes() 761 dsS.Get(ctx).Testable().CatchupIndexes()
758 762
759 results = nil 763 results = nil
760 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q , &results), ShouldBeNil) 764 So(dsS.Get(infoS.Get(ctx).MustNamespace("qux")).GetAll(q , &results), ShouldBeNil)
761 So(len(results), ShouldEqual, 2) 765 So(len(results), ShouldEqual, 2)
762 }) 766 })
763 }) 767 })
764 } 768 }
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