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

Side by Side Diff: service/datastore/checkfilter_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/prod/raw_datastore_type_converter.go ('k') | service/datastore/context.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 // adapted from github.com/golang/appengine/datastore 5 // adapted from github.com/golang/appengine/datastore
6 6
7 package datastore 7 package datastore
8 8
9 import ( 9 import (
10 "testing" 10 "testing"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 }), ShouldBeNil) 57 }), ShouldBeNil)
58 }, ShouldPanic) 58 }, ShouldPanic)
59 So(hit, ShouldBeFalse) 59 So(hit, ShouldBeFalse)
60 }) 60 })
61 61
62 Convey("GetMulti", func() { 62 Convey("GetMulti", func() {
63 So(rds.GetMulti(nil, nil, nil), ShouldBeNil) 63 So(rds.GetMulti(nil, nil, nil), ShouldBeNil)
64 So(rds.GetMulti([]*Key{mkKey("", "", "", "")}, nil, nil) .Error(), ShouldContainSubstring, "is nil") 64 So(rds.GetMulti([]*Key{mkKey("", "", "", "")}, nil, nil) .Error(), ShouldContainSubstring, "is nil")
65 65
66 // this is in the wrong aid/ns 66 // this is in the wrong aid/ns
67 » » » keys := []*Key{KeyContext{"wut", "wrong"}.MakeKey("Kind" , 1)} 67 » » » keys := []*Key{MkKeyContext("wut", "wrong").MakeKey("Kin d", 1)}
68 So(rds.GetMulti(keys, nil, func(pm PropertyMap, err erro r) error { 68 So(rds.GetMulti(keys, nil, func(pm PropertyMap, err erro r) error {
69 So(pm, ShouldBeNil) 69 So(pm, ShouldBeNil)
70 So(err, ShouldEqual, ErrInvalidKey) 70 So(err, ShouldEqual, ErrInvalidKey)
71 return nil 71 return nil
72 }), ShouldBeNil) 72 }), ShouldBeNil)
73 73
74 keys[0] = mkKey("Kind", 1) 74 keys[0] = mkKey("Kind", 1)
75 hit := false 75 hit := false
76 So(func() { 76 So(func() {
77 So(rds.GetMulti(keys, nil, func(pm PropertyMap, err error) error { 77 So(rds.GetMulti(keys, nil, func(pm PropertyMap, err error) error {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 So(rds.DeleteMulti([]*Key{mkKey("s~aid", "ns", " Kind", 1)}, func(error) error { 130 So(rds.DeleteMulti([]*Key{mkKey("s~aid", "ns", " Kind", 1)}, func(error) error {
131 hit = true 131 hit = true
132 return nil 132 return nil
133 }), ShouldBeNil) 133 }), ShouldBeNil)
134 }, ShouldPanic) 134 }, ShouldPanic)
135 So(hit, ShouldBeFalse) 135 So(hit, ShouldBeFalse)
136 }) 136 })
137 137
138 }) 138 })
139 } 139 }
OLDNEW
« no previous file with comments | « impl/prod/raw_datastore_type_converter.go ('k') | service/datastore/context.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698