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

Unified Diff: impl/memory/datastore_test.go

Issue 1372473002: Add the ability to disable special automatic entities in impl/memory (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: add more docstring 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
« no previous file with comments | « impl/memory/datastore_data.go ('k') | service/datastore/testable.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_test.go
diff --git a/impl/memory/datastore_test.go b/impl/memory/datastore_test.go
index 0c1e39a2706bd0145c1fd19bd1a83b6b9f8da93a..a95832ff71ef97de1210ffdf5edd29cbd0b97500 100644
--- a/impl/memory/datastore_test.go
+++ b/impl/memory/datastore_test.go
@@ -12,6 +12,7 @@ import (
dsS "github.com/luci/gae/service/datastore"
"github.com/luci/gae/service/datastore/serialize"
infoS "github.com/luci/gae/service/info"
+ . "github.com/luci/luci-go/common/testing/assertions"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)
@@ -513,6 +514,20 @@ func TestDatastoreSingleReadWriter(t *testing.T) {
So(count, ShouldEqual, 6)
})
})
+
+ Convey("Testable.DisableSpecialEntities", func() {
+ ds.Testable().DisableSpecialEntities(true)
+
+ So(ds.Put(&Foo{}), ShouldErrLike, "allocateIDs is disabled")
+
+ So(ds.Put(&Foo{ID: 1}), ShouldBeNil)
+
+ ds.Testable().CatchupIndexes()
+
+ count, err := ds.Count(dsS.NewQuery(""))
+ So(err, ShouldBeNil)
+ So(count, ShouldEqual, 1) // normally this would include __entity_group__
+ })
})
}
« no previous file with comments | « impl/memory/datastore_data.go ('k') | service/datastore/testable.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698