Index: service/datastore/datastore_test.go |
diff --git a/service/datastore/datastore_test.go b/service/datastore/datastore_test.go |
index 2c2967537051863ab635c181c8884c793e7dac40..d86123f523ef16a5d349cf9ebccd4c9580f9f1a4 100644 |
--- a/service/datastore/datastore_test.go |
+++ b/service/datastore/datastore_test.go |
@@ -90,6 +90,8 @@ func (f *fakeDatastore) GetMulti(keys []*Key, _meta MultiMetaGetter, cb GetMulti |
for i, k := range keys { |
if k.Kind() == "Fail" { |
cb(nil, errors.New("GetMulti fail")) |
+ } else if k.Kind() == "DNE" { |
+ cb(nil, ErrNoSuchEntity) |
} else { |
cb(PropertyMap{"Value": {MkProperty(i + 1)}}, nil) |
} |
@@ -298,6 +300,19 @@ func TestKeyForObj(t *testing.T) { |
So(ds.KeyForObj(pls).String(), ShouldEqual, `s~aid:ns:/Hello,"world"/CommonStruct,1`) |
}) |
+ Convey("can see if things exist", func() { |
+ e, err := ds.Exists(k) |
+ So(err, ShouldBeNil) |
+ So(e, ShouldBeTrue) |
+ |
+ e, err = ds.Exists(ds.MakeKey("DNE", "nope")) |
+ So(err, ShouldBeNil) |
+ So(e, ShouldBeFalse) |
+ |
+ _, err = ds.Exists(ds.MakeKey("Fail", "boom")) |
+ So(err, ShouldErrLike, "GetMulti fail") |
+ }) |
+ |
}) |
Convey("bad", func() { |