Index: service/datastore/datastore_test.go |
diff --git a/service/datastore/datastore_test.go b/service/datastore/datastore_test.go |
index 2e3b7fa1ba5e922558f5ff0b52ccfef76a18b38d..8c536bd9c3a561a30b9f6d5e66e92b122f75b7e4 100644 |
--- a/service/datastore/datastore_test.go |
+++ b/service/datastore/datastore_test.go |
@@ -414,6 +414,16 @@ func TestPut(t *testing.T) { |
s := MGSWithNoKind{} |
So(ds.Put(&s), ShouldErrLike, "unable to extract $kind") |
}) |
+ |
+ Convey("struct with invalid but non-nil key is an error", func() { |
+ type BadParent struct { |
+ ID int64 `gae:"$id"` |
+ Parent *Key `gae:"$parent"` |
+ } |
+ // having an Incomplete parent makes an invalid key |
+ bp := &BadParent{ID: 1, Parent: ds.MakeKey("Something", 0)} |
+ So(ds.Put(bp), ShouldErrLike, ErrInvalidKey) |
+ }) |
}) |
Convey("ok", func() { |