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

Unified Diff: service/datastore/datastore_test.go

Issue 1427933002: Decouple PLS from MGS. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Update dox w/ example. Created 5 years, 2 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 | « no previous file | service/datastore/interface.go » ('j') | service/datastore/interface.go » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: service/datastore/datastore_test.go
diff --git a/service/datastore/datastore_test.go b/service/datastore/datastore_test.go
index d86123f523ef16a5d349cf9ebccd4c9580f9f1a4..f60da23cd2530f144bd291410d3022cc052a419d 100644
--- a/service/datastore/datastore_test.go
+++ b/service/datastore/datastore_test.go
@@ -241,6 +241,28 @@ func (f *FakePLS) Problem() error {
return nil
}
+type MGSWithNoKind struct {
+ S string
+}
+
+func (s *MGSWithNoKind) GetMetaDefault(key string, dflt interface{}) interface{} {
+ return GetMetaDefaultImpl(s.GetMeta, key, dflt)
+}
+
+func (s *MGSWithNoKind) GetMeta(key string) (interface{}, error) {
+ return nil, ErrMetaFieldUnset
+}
+
+func (s *MGSWithNoKind) GetAllMeta() PropertyMap {
+ return PropertyMap{}
+}
+
+func (s *MGSWithNoKind) SetMeta(key string, val interface{}) error {
+ return ErrMetaFieldUnset
+}
+
+var _ MetaGetterSetter = (*MGSWithNoKind)(nil)
+
func TestKeyForObj(t *testing.T) {
t.Parallel()
@@ -376,6 +398,11 @@ func TestPut(t *testing.T) {
cs := CommonStruct{}
So(ds.Put(cs).Error(), ShouldContainSubstring, "invalid Put input type")
})
+
+ Convey("struct with no $kind is an error", func() {
+ s := MGSWithNoKind{}
+ So(ds.Put(&s).Error(), ShouldContainSubstring, "unable to extract $kind")
+ })
})
Convey("ok", func() {
« no previous file with comments | « no previous file | service/datastore/interface.go » ('j') | service/datastore/interface.go » ('J')

Powered by Google App Engine
This is Rietveld 408576698