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

Side by Side Diff: service/datastore/pls_test.go

Issue 1289323002: Fix miscellaneous prod bugs. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Remove superfluous function added in PS#1. Created 5 years, 4 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 unified diff | Download patch
OLDNEW
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 "bytes" 10 "bytes"
(...skipping 1696 matching lines...) Expand 10 before | Expand all | Expand 10 after
1707 type OKDefaults struct { 1707 type OKDefaults struct {
1708 When string `gae:"$when,tomorrow"` 1708 When string `gae:"$when,tomorrow"`
1709 Amount int64 `gae:"$amt,100"` 1709 Amount int64 `gae:"$amt,100"`
1710 } 1710 }
1711 pls := GetPLS(&OKDefaults{}) 1711 pls := GetPLS(&OKDefaults{})
1712 pm, err := pls.Save(true) 1712 pm, err := pls.Save(true)
1713 So(err, ShouldBeNil) 1713 So(err, ShouldBeNil)
1714 So(pm, ShouldResemble, PropertyMap{ 1714 So(pm, ShouldResemble, PropertyMap{
1715 "$when": {mpNI("tomorrow")}, 1715 "$when": {mpNI("tomorrow")},
1716 "$amt": {mpNI(100)}, 1716 "$amt": {mpNI(100)},
1717 "$kind": {mp("OKDefaults")},
iannucci 2015/08/15 21:50:54 technically when you SetMeta on a PropertyMap, it
dnj (Google) 2015/08/16 06:11:06 Switched to NI.
1717 }) 1718 })
1718 1719
1719 v, err := pm.GetMeta("when") 1720 v, err := pm.GetMeta("when")
1720 So(err, ShouldBeNil) 1721 So(err, ShouldBeNil)
1721 So(v, ShouldEqual, "tomorrow") 1722 So(v, ShouldEqual, "tomorrow")
1722 1723
1723 v, err = pm.GetMeta("amt") 1724 v, err = pm.GetMeta("amt")
1724 So(err, ShouldBeNil) 1725 So(err, ShouldBeNil)
1725 So(v, ShouldEqual, int64(100)) 1726 So(v, ShouldEqual, int64(100))
1726 }) 1727 })
(...skipping 29 matching lines...) Expand all
1756 1757
1757 Convey("Bad default meta type", func() { 1758 Convey("Bad default meta type", func() {
1758 type BadDefault struct { 1759 type BadDefault struct {
1759 Val time.Time `gae:"$meta,tomorrow"` 1760 Val time.Time `gae:"$meta,tomorrow"`
1760 } 1761 }
1761 pls := GetPLS(&BadDefault{}) 1762 pls := GetPLS(&BadDefault{})
1762 So(pls.Problem().Error(), ShouldContainSubstring, "bad t ype") 1763 So(pls.Problem().Error(), ShouldContainSubstring, "bad t ype")
1763 }) 1764 })
1764 }) 1765 })
1765 } 1766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698