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

Unified Diff: service/rawdatastore/datastore_test.go

Issue 1259463002: Add BoolFlag for rawdatastore. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: rename to toggle Created 5 years, 5 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/rawdatastore/datastore_test.go
diff --git a/service/rawdatastore/datastore_test.go b/service/rawdatastore/datastore_test.go
index 462fe7cfac382ea5e6c20ac429050da0031821b7..1b10ef1d828b71b657e887762f3a8baffd50e7e2 100644
--- a/service/rawdatastore/datastore_test.go
+++ b/service/rawdatastore/datastore_test.go
@@ -1643,8 +1643,10 @@ func TestSpecial(t *testing.T) {
type OKDefaults struct {
When string `gae:"$when,tomorrow"`
Amount int64 `gae:"$amt,100"`
+ DoIt Toggle `gae:"$doit,on"`
}
- pls := GetPLS(&OKDefaults{})
+ okd := &OKDefaults{}
+ pls := GetPLS(okd)
So(pls.Problem(), ShouldBeNil)
v, err := pls.GetMeta("when")
@@ -1654,6 +1656,25 @@ func TestSpecial(t *testing.T) {
v, err = pls.GetMeta("amt")
So(err, ShouldBeNil)
So(v, ShouldEqual, int64(100))
+
+ So(okd.DoIt, ShouldEqual, Auto)
+ v, err = pls.GetMeta("doit")
+ So(err, ShouldBeNil)
+ So(v, ShouldBeTrue)
+
+ err = pls.SetMeta("doit", false)
+ So(err, ShouldBeNil)
+ v, err = pls.GetMeta("doit")
+ So(err, ShouldBeNil)
+ So(v, ShouldBeFalse)
+ So(okd.DoIt, ShouldEqual, Off)
+
+ err = pls.SetMeta("doit", true)
+ So(err, ShouldBeNil)
+ v, err = pls.GetMeta("doit")
+ So(err, ShouldBeNil)
+ So(v, ShouldBeTrue)
+ So(okd.DoIt, ShouldEqual, On)
})
Convey("meta fields can be saved", func() {

Powered by Google App Engine
This is Rietveld 408576698