| Index: service/datastore/checkfilter_test.go
|
| diff --git a/service/datastore/checkfilter_test.go b/service/datastore/checkfilter_test.go
|
| index 12e7911c0341547d6fbc1b22fb622b19dcbbccf2..1eab863e3eedf0f141e43196efb03e7acda204e0 100644
|
| --- a/service/datastore/checkfilter_test.go
|
| +++ b/service/datastore/checkfilter_test.go
|
| @@ -16,8 +16,6 @@ import (
|
|
|
| type fakeRDS struct{ RawInterface }
|
|
|
| -func (fakeRDS) NewQuery(string) Query { return &fakeQuery{} }
|
| -
|
| func TestCheckFilter(t *testing.T) {
|
| t.Parallel()
|
|
|
| @@ -46,10 +44,13 @@ func TestCheckFilter(t *testing.T) {
|
|
|
| Convey("Run", func() {
|
| So(rds.Run(nil, nil).Error(), ShouldContainSubstring, "query is nil")
|
| - So(rds.Run(rds.NewQuery("sup"), nil).Error(), ShouldContainSubstring, "callback is nil")
|
| + fq, err := NewQuery("sup").Finalize()
|
| + So(err, ShouldBeNil)
|
| +
|
| + So(rds.Run(fq, nil).Error(), ShouldContainSubstring, "callback is nil")
|
| hit := false
|
| So(func() {
|
| - rds.Run(rds.NewQuery("sup"), func(Key, PropertyMap, CursorCB) bool {
|
| + rds.Run(fq, func(*Key, PropertyMap, CursorCB) bool {
|
| hit = true
|
| return true
|
| })
|
| @@ -59,16 +60,16 @@ func TestCheckFilter(t *testing.T) {
|
|
|
| Convey("GetMulti", func() {
|
| So(rds.GetMulti(nil, nil, nil), ShouldBeNil)
|
| - So(rds.GetMulti([]Key{mkKey("", "", "", "")}, nil, nil).Error(), ShouldContainSubstring, "is nil")
|
| + So(rds.GetMulti([]*Key{mkKey("", "", "", "")}, nil, nil).Error(), ShouldContainSubstring, "is nil")
|
|
|
| // this is in the wrong aid/ns
|
| - keys := []Key{mkKey("wut", "wrong", "Kind", 1)}
|
| + keys := []*Key{MakeKey("wut", "wrong", "Kind", 1)}
|
| So(rds.GetMulti(keys, nil, func(pm PropertyMap, err error) {
|
| So(pm, ShouldBeNil)
|
| So(err, ShouldEqual, ErrInvalidKey)
|
| }), ShouldBeNil)
|
|
|
| - keys[0] = mkKey("s~aid", "ns", "Kind", 1)
|
| + keys[0] = mkKey("Kind", 1)
|
| hit := false
|
| So(func() {
|
| rds.GetMulti(keys, nil, func(pm PropertyMap, err error) {
|
| @@ -79,24 +80,23 @@ func TestCheckFilter(t *testing.T) {
|
| })
|
|
|
| Convey("PutMulti", func() {
|
| - keys := []Key{}
|
| + keys := []*Key{}
|
| vals := []PropertyMap{{}}
|
| So(rds.PutMulti(keys, vals, nil).Error(),
|
| ShouldContainSubstring, "mismatched keys/vals")
|
| So(rds.PutMulti(nil, nil, nil), ShouldBeNil)
|
|
|
| - badParent := mkKey("aid", "ns", "Wut", 0)
|
| - keys = append(keys, mkKey("aid", "ns", "Kind", 0, badParent))
|
| + keys = append(keys, mkKey("aid", "ns", "Wut", 0, "Kind", 0))
|
| So(rds.PutMulti(keys, vals, nil).Error(), ShouldContainSubstring, "callback is nil")
|
|
|
| - So(rds.PutMulti(keys, vals, func(k Key, err error) {
|
| + So(rds.PutMulti(keys, vals, func(k *Key, err error) {
|
| So(k, ShouldBeNil)
|
| So(err, ShouldEqual, ErrInvalidKey)
|
| }), ShouldBeNil)
|
|
|
| - keys = []Key{mkKey("s~aid", "ns", "Kind", 0)}
|
| + keys = []*Key{mkKey("s~aid", "ns", "Kind", 0)}
|
| vals = []PropertyMap{nil}
|
| - So(rds.PutMulti(keys, vals, func(k Key, err error) {
|
| + So(rds.PutMulti(keys, vals, func(k *Key, err error) {
|
| So(k, ShouldBeNil)
|
| So(err.Error(), ShouldContainSubstring, "nil vals entry")
|
| }), ShouldBeNil)
|
| @@ -104,7 +104,7 @@ func TestCheckFilter(t *testing.T) {
|
| vals = []PropertyMap{{}}
|
| hit := false
|
| So(func() {
|
| - rds.PutMulti(keys, vals, func(k Key, err error) {
|
| + rds.PutMulti(keys, vals, func(k *Key, err error) {
|
| hit = true
|
| })
|
| }, ShouldPanic)
|
| @@ -113,14 +113,14 @@ func TestCheckFilter(t *testing.T) {
|
|
|
| Convey("DeleteMulti", func() {
|
| So(rds.DeleteMulti(nil, nil), ShouldBeNil)
|
| - So(rds.DeleteMulti([]Key{mkKey("", "", "", "")}, nil).Error(), ShouldContainSubstring, "is nil")
|
| - So(rds.DeleteMulti([]Key{mkKey("", "", "", "")}, func(err error) {
|
| + So(rds.DeleteMulti([]*Key{mkKey("", "", "", "")}, nil).Error(), ShouldContainSubstring, "is nil")
|
| + So(rds.DeleteMulti([]*Key{mkKey("", "", "", "")}, func(err error) {
|
| So(err, ShouldEqual, ErrInvalidKey)
|
| }), ShouldBeNil)
|
|
|
| hit := false
|
| So(func() {
|
| - rds.DeleteMulti([]Key{mkKey("s~aid", "ns", "Kind", 1)}, func(error) {
|
| + rds.DeleteMulti([]*Key{mkKey("s~aid", "ns", "Kind", 1)}, func(error) {
|
| hit = true
|
| })
|
| }, ShouldPanic)
|
|
|