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

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

Issue 2353063004: Add "MkKeyContext" KeyContext generation function. (Closed)
Patch Set: Created 4 years, 3 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_query_test.go ('k') | impl/memory/testing_utils_test.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 LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package memory 5 package memory
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "fmt" 9 "fmt"
10 "testing" 10 "testing"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 "$id": propNI(1), 93 "$id": propNI(1),
94 "$kind": propNI("Foo"), 94 "$kind": propNI("Foo"),
95 } 95 }
96 So(ds.Get(c, pmap), ShouldBeNil) 96 So(ds.Get(c, pmap), ShouldBeNil)
97 So(pmap, ShouldResemble, ds.PropertyMap{ 97 So(pmap, ShouldResemble, ds.PropertyMap{
98 "$id": propNI(1), 98 "$id": propNI(1),
99 "$kind": propNI("Foo"), 99 "$kind": propNI("Foo"),
100 "Name": prop(""), 100 "Name": prop(""),
101 "Val": prop(10), 101 "Val": prop(10),
102 "Multi": ds.PropertySlice{prop("foo"), p rop("bar")}, 102 "Multi": ds.PropertySlice{prop("foo"), p rop("bar")},
103 » » » » » "Key": prop(ds.KeyContext{"dev~app", " "}.MakeKey("Bar", "Baz")), 103 » » » » » "Key": prop(ds.MkKeyContext("dev~app", "").MakeKey("Bar", "Baz")),
104 }) 104 })
105 }) 105 })
106 Convey("Deleteing with a bogus key is bad", func() { 106 Convey("Deleteing with a bogus key is bad", func() {
107 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 100, nil)), ShouldEqual, ds.ErrInvalidKey) 107 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 100, nil)), ShouldEqual, ds.ErrInvalidKey)
108 }) 108 })
109 Convey("Deleteing a DNE entity is fine", func() { 109 Convey("Deleteing a DNE entity is fine", func() {
110 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 0, ni l)), ShouldBeNil) 110 So(ds.Delete(c, ds.NewKey(c, "Foo", "wat", 0, ni l)), ShouldBeNil)
111 }) 111 })
112 112
113 Convey("Deleting entities from a nonexistant namespace w orks", func() { 113 Convey("Deleting entities from a nonexistant namespace w orks", func() {
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 // Add "foos" to a new namespace, then confirm that it g ets indexed. 808 // Add "foos" to a new namespace, then confirm that it g ets indexed.
809 So(ds.Put(infoS.MustNamespace(ctx, "qux"), foos), Should BeNil) 809 So(ds.Put(infoS.MustNamespace(ctx, "qux"), foos), Should BeNil)
810 ds.GetTestable(ctx).CatchupIndexes() 810 ds.GetTestable(ctx).CatchupIndexes()
811 811
812 results = nil 812 results = nil
813 So(ds.GetAll(infoS.MustNamespace(ctx, "qux"), q, &result s), ShouldBeNil) 813 So(ds.GetAll(infoS.MustNamespace(ctx, "qux"), q, &result s), ShouldBeNil)
814 So(len(results), ShouldEqual, 2) 814 So(len(results), ShouldEqual, 2)
815 }) 815 })
816 }) 816 })
817 } 817 }
OLDNEW
« no previous file with comments | « impl/memory/datastore_query_test.go ('k') | impl/memory/testing_utils_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698