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

Unified Diff: service/datastore/datastore_test.go

Issue 1292913002: Split off serialization and key functions to their own packages. (Closed) Base URL: https://github.com/luci/gae.git@make_queries_better
Patch Set: rebase Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « service/datastore/context_test.go ('k') | service/datastore/dskey/doc.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/datastore_test.go
diff --git a/service/datastore/datastore_test.go b/service/datastore/datastore_test.go
index 6a73c108604b6b65f558989e6450af113d955f81..f480e59963543a1b04559f0686c705ec00a46744 100644
--- a/service/datastore/datastore_test.go
+++ b/service/datastore/datastore_test.go
@@ -61,7 +61,11 @@ type fakeDatastore struct {
}
func (f *fakeDatastore) NewKey(kind, stringID string, intID int64, parent Key) Key {
- return NewKey(f.aid, f.ns, kind, stringID, intID, parent)
+ id := interface{}(stringID)
+ if stringID == "" {
+ id = intID
+ }
+ return mkKey(f.aid, f.ns, kind, id, parent)
}
func (f *fakeDatastore) NewQuery(string) Query {
@@ -107,8 +111,8 @@ func (f *fakeDatastore) PutMulti(keys []Key, vals []PropertyMap, cb PutMultiCB)
if assertExtra {
So(vals[i]["Extra"], ShouldResemble, []Property{MkProperty("whoa")})
}
- if KeyIncomplete(k) {
- k = NewKey(k.AppID(), k.Namespace(), k.Kind(), "", int64(i+1), k.Parent())
+ if k.Incomplete() {
+ k = mkKey(k.AppID(), k.Namespace(), k.Kind(), int64(i+1), k.Parent())
}
}
cb(k, err)
@@ -548,8 +552,8 @@ func TestDelete(t *testing.T) {
Convey("bad", func() {
Convey("get single error for RPC failure", func() {
keys := []Key{
- NewKey("aid", "ns", "FailAll", "", 1, nil),
- NewKey("aid", "ns", "Ok", "", 1, nil),
+ mkKey("aid", "ns", "FailAll", 1, nil),
+ mkKey("aid", "ns", "Ok", 1, nil),
}
So(ds.DeleteMulti(keys).Error(), ShouldEqual, "DeleteMulti fail all")
})
« no previous file with comments | « service/datastore/context_test.go ('k') | service/datastore/dskey/doc.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698