OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package dummy | 5 package dummy |
6 | 6 |
7 import ( | 7 import ( |
8 "testing" | 8 "testing" |
9 | 9 |
| 10 dsS "github.com/luci/gae/service/datastore" |
10 infoS "github.com/luci/gae/service/info" | 11 infoS "github.com/luci/gae/service/info" |
11 mcS "github.com/luci/gae/service/memcache" | 12 mcS "github.com/luci/gae/service/memcache" |
12 rdsS "github.com/luci/gae/service/rawdatastore" | |
13 tqS "github.com/luci/gae/service/taskqueue" | 13 tqS "github.com/luci/gae/service/taskqueue" |
14 . "github.com/smartystreets/goconvey/convey" | 14 . "github.com/smartystreets/goconvey/convey" |
15 "golang.org/x/net/context" | 15 "golang.org/x/net/context" |
16 ) | 16 ) |
17 | 17 |
18 func TestContextAccess(t *testing.T) { | 18 func TestContextAccess(t *testing.T) { |
19 t.Parallel() | 19 t.Parallel() |
20 | 20 |
21 // p is a function which recovers an error and then immediately panics w
ith | 21 // p is a function which recovers an error and then immediately panics w
ith |
22 // the contained string. It's defer'd in each test so that we can use th
e | 22 // the contained string. It's defer'd in each test so that we can use th
e |
(...skipping 15 matching lines...) Expand all Loading... |
38 | 38 |
39 Convey("Info", func() { | 39 Convey("Info", func() { |
40 So(infoS.Get(c), ShouldNotBeNil) | 40 So(infoS.Get(c), ShouldNotBeNil) |
41 So(func() { | 41 So(func() { |
42 defer p() | 42 defer p() |
43 infoS.Get(c).Datacenter() | 43 infoS.Get(c).Datacenter() |
44 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") | 44 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") |
45 }) | 45 }) |
46 | 46 |
47 Convey("RawDatastore", func() { | 47 Convey("RawDatastore", func() { |
48 » » » c = rdsS.Set(c, RawDatastore()) | 48 » » » c = dsS.SetRaw(c, RawDatastore()) |
49 » » » So(rdsS.Get(c), ShouldNotBeNil) | 49 » » » So(dsS.Get(c), ShouldNotBeNil) |
50 So(func() { | 50 So(func() { |
51 defer p() | 51 defer p() |
52 » » » » rdsS.Get(c).DecodeKey("wut") | 52 » » » » dsS.Get(c).DecodeKey("wut") |
53 }, ShouldPanicWith, "dummy: method RawDatastore.DecodeKe
y is not implemented") | 53 }, ShouldPanicWith, "dummy: method RawDatastore.DecodeKe
y is not implemented") |
54 }) | 54 }) |
55 | 55 |
56 Convey("Memcache", func() { | 56 Convey("Memcache", func() { |
57 c = mcS.Set(c, Memcache()) | 57 c = mcS.Set(c, Memcache()) |
58 So(mcS.Get(c), ShouldNotBeNil) | 58 So(mcS.Get(c), ShouldNotBeNil) |
59 So(func() { | 59 So(func() { |
60 defer p() | 60 defer p() |
61 mcS.Get(c).Add(nil) | 61 mcS.Get(c).Add(nil) |
62 }, ShouldPanicWith, "dummy: method Memcache.Add is not i
mplemented") | 62 }, ShouldPanicWith, "dummy: method Memcache.Add is not i
mplemented") |
63 }) | 63 }) |
64 | 64 |
65 Convey("TaskQueue", func() { | 65 Convey("TaskQueue", func() { |
66 c = tqS.Set(c, TaskQueue()) | 66 c = tqS.Set(c, TaskQueue()) |
67 So(tqS.Get(c), ShouldNotBeNil) | 67 So(tqS.Get(c), ShouldNotBeNil) |
68 So(func() { | 68 So(func() { |
69 defer p() | 69 defer p() |
70 tqS.Get(c).Purge("") | 70 tqS.Get(c).Purge("") |
71 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") | 71 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") |
72 }) | 72 }) |
73 | 73 |
74 }) | 74 }) |
75 } | 75 } |
OLD | NEW |