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

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: 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..ae4d9abe08d665d74ea47de81fd82e73909c3e72 100644
--- a/service/rawdatastore/datastore_test.go
+++ b/service/rawdatastore/datastore_test.go
@@ -1641,10 +1641,12 @@ func TestSpecial(t *testing.T) {
Convey("convertible meta default types", func() {
type OKDefaults struct {
- When string `gae:"$when,tomorrow"`
- Amount int64 `gae:"$amt,100"`
+ When string `gae:"$when,tomorrow"`
+ Amount int64 `gae:"$amt,100"`
+ DoIt BoolFlag `gae:"$doit,true"`
}
- 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, False)
+
+ err = pls.SetMeta("doit", true)
+ So(err, ShouldBeNil)
+ v, err = pls.GetMeta("doit")
+ So(err, ShouldBeNil)
+ So(v, ShouldBeTrue)
+ So(okd.DoIt, ShouldEqual, True)
})
Convey("meta fields can be saved", func() {

Powered by Google App Engine
This is Rietveld 408576698