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

Unified Diff: service/datastore/serialize/serialize_test.go

Issue 1355783002: Refactor keys and queries in datastore service and implementation. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: service/datastore/serialize/serialize_test.go
diff --git a/service/datastore/serialize/serialize_test.go b/service/datastore/serialize/serialize_test.go
index 63f44d01b6b3b0b094cae2d2d1dce6ccfee405ae..a84368bca0dab7bbc72ffbf888c0cf9f7e318385 100644
--- a/service/datastore/serialize/serialize_test.go
+++ b/service/datastore/serialize/serialize_test.go
@@ -13,7 +13,6 @@ import (
"github.com/luci/gae/service/blobstore"
ds "github.com/luci/gae/service/datastore"
- "github.com/luci/gae/service/datastore/dskey"
"github.com/luci/luci-go/common/cmpbin"
. "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
@@ -33,25 +32,7 @@ type dspmapTC struct {
props ds.PropertyMap
}
-// TODO(riannucci): dedup with datastore/key testing file.
-func mkKey(aid, ns string, elems ...interface{}) ds.Key {
- if len(elems)%2 != 0 {
- panic("odd number of tokens")
- }
- toks := make([]ds.KeyTok, len(elems)/2)
- for i := 0; i < len(elems); i += 2 {
- toks[i/2].Kind = elems[i].(string)
- switch x := elems[i+1].(type) {
- case string:
- toks[i/2].StringID = x
- case int:
- toks[i/2].IntID = int64(x)
- default:
- panic("bad token id")
- }
- }
- return dskey.NewToks(aid, ns, toks)
-}
+var mkKey = ds.MakeKey
func mkBuf(data []byte) Buffer {
return Invertible(bytes.NewBuffer(data))
@@ -62,7 +43,7 @@ func ShouldEqualKey(actual interface{}, expected ...interface{}) string {
if len(expected) != 1 {
return fmt.Sprintf("Assertion requires 1 expected value, got %d", len(expected))
}
- if dskey.Equal(actual.(ds.Key), expected[0].(ds.Key)) {
+ if actual.(*ds.Key).Equal(expected[0].(*ds.Key)) {
return ""
}
return fmt.Sprintf("Expected: %q\nActual: %q", actual, expected[0])
« service/datastore/raw_interface.go ('K') | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698