| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // 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 "fmt" | 10 "fmt" |
| 11 "testing" | 11 "testing" |
| 12 | 12 |
| 13 "github.com/luci/gae/service/info" | 13 "github.com/luci/gae/service/info" |
| 14 "github.com/luci/luci-go/common/errors" | 14 "github.com/luci/luci-go/common/errors" |
| 15 . "github.com/luci/luci-go/common/testing/assertions" | 15 . "github.com/luci/luci-go/common/testing/assertions" |
| 16 . "github.com/smartystreets/goconvey/convey" | 16 . "github.com/smartystreets/goconvey/convey" |
| 17 "golang.org/x/net/context" | 17 "golang.org/x/net/context" |
| 18 ) | 18 ) |
| 19 | 19 |
| 20 func fakeDatastoreFactory(c context.Context) RawInterface { | 20 func fakeDatastoreFactory(c context.Context, wantTxn bool) RawInterface { |
| 21 i := info.Get(c) | 21 i := info.Get(c) |
| 22 return &fakeDatastore{ | 22 return &fakeDatastore{ |
| 23 aid: i.FullyQualifiedAppID(), | 23 aid: i.FullyQualifiedAppID(), |
| 24 ns: i.GetNamespace(), | 24 ns: i.GetNamespace(), |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 type fakeDatastore struct { | 28 type fakeDatastore struct { |
| 29 RawInterface | 29 RawInterface |
| 30 aid string | 30 aid string |
| (...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 So(ds.Run(q, func(k *Key, _ CursorCB) bool { | 915 So(ds.Run(q, func(k *Key, _ CursorCB) bool { |
| 916 So(k.IntID(), ShouldEqual, i+1) | 916 So(k.IntID(), ShouldEqual, i+1) |
| 917 i++ | 917 i++ |
| 918 return true | 918 return true |
| 919 }), ShouldBeNil) | 919 }), ShouldBeNil) |
| 920 }) | 920 }) |
| 921 | 921 |
| 922 }) | 922 }) |
| 923 }) | 923 }) |
| 924 } | 924 } |
| OLD | NEW |