Index: go/src/infra/gae/libs/gae/dummy/dummy_test.go |
diff --git a/go/src/infra/gae/libs/gae/dummy/dummy_test.go b/go/src/infra/gae/libs/gae/dummy/dummy_test.go |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d51523f961b3803d0754400b0a34d06bbfe31514 |
--- /dev/null |
+++ b/go/src/infra/gae/libs/gae/dummy/dummy_test.go |
@@ -0,0 +1,73 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package dummy |
+ |
+import ( |
+ "golang.org/x/net/context" |
+ "testing" |
+ |
+ "infra/gae/libs/gae" |
+ |
+ . "github.com/smartystreets/goconvey/convey" |
+) |
+ |
+func TestContextAccess(t *testing.T) { |
+ t.Parallel() |
+ p := func() { panic(recover().(error).Error()) } |
estaab
2015/07/13 18:26:35
For my own understanding what is this doing? Is th
iannucci
2015/07/14 01:35:53
it's maybe not completely obvious. I've added a co
|
+ |
+ Convey("Context Access", t, func() { |
+ c := context.Background() |
+ |
+ Convey("blank", func() { |
+ So(gae.GetMC(c), ShouldBeNil) |
+ So(gae.GetTQ(c), ShouldBeNil) |
+ So(gae.GetGI(c), ShouldBeNil) |
+ }) |
+ |
+ Convey("RDS", func() { |
+ c = gae.SetRDS(c, RDS()) |
+ So(gae.GetRDS(c), ShouldNotBeNil) |
+ So(func() { |
+ defer p() |
+ gae.GetRDS(c).NewKey("", "", 1, nil) |
+ }, ShouldPanicWith, "dummy: method RawDatastore.NewKey is not implemented") |
+ }) |
+ |
+ Convey("MC", func() { |
+ c = gae.SetMC(c, MC()) |
+ So(gae.GetMC(c), ShouldNotBeNil) |
+ So(func() { |
+ defer p() |
+ gae.GetMC(c).InflateCodec(gae.MCCodecDef{}) |
+ }, ShouldPanicWith, "dummy: method Memcache.InflateCodec is not implemented") |
+ }) |
+ |
+ Convey("TQ", func() { |
+ c = gae.SetTQ(c, TQ()) |
+ So(gae.GetTQ(c), ShouldNotBeNil) |
+ So(func() { |
+ defer p() |
+ gae.GetTQ(c).Purge("") |
+ }, ShouldPanicWith, "dummy: method TaskQueue.Purge is not implemented") |
+ }) |
+ |
+ Convey("GI", func() { |
+ c = gae.SetGI(c, GI()) |
+ So(gae.GetGI(c), ShouldNotBeNil) |
+ So(func() { |
+ defer p() |
+ gae.GetGI(c).Datacenter() |
+ }, ShouldPanicWith, "dummy: method GlobalInformation.Datacenter is not implemented") |
+ }) |
+ |
+ Convey("QY", func() { |
+ q := QY() |
+ So(func() { |
+ defer p() |
+ q.Distinct() |
+ }, ShouldPanicWith, "dummy: method DSQuery.Distinct is not implemented") |
+ }) |
+ }) |
+} |