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() { |