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 dsS "github.com/luci/gae/service/datastore" |
(...skipping 10 matching lines...) Expand all Loading... |
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 |
23 // ShouldPanicWith assertion (which does an == comparison and not | 23 // ShouldPanicWith assertion (which does an == comparison and not |
24 // a reflect.DeepEquals comparison). | 24 // a reflect.DeepEquals comparison). |
25 p := func() { panic(recover().(error).Error()) } | 25 p := func() { panic(recover().(error).Error()) } |
26 | 26 |
27 Convey("Context Access", t, func() { | 27 Convey("Context Access", t, func() { |
28 c := context.Background() | 28 c := context.Background() |
29 | 29 |
30 Convey("blank", func() { | 30 Convey("blank", func() { |
31 » » » So(mcS.Get(c), ShouldBeNil) | 31 » » » So(dsS.GetRaw(c), ShouldBeNil) |
32 » » » So(tqS.Get(c), ShouldBeNil) | 32 » » » So(mcS.GetRaw(c), ShouldBeNil) |
| 33 » » » So(tqS.GetRaw(c), ShouldBeNil) |
33 So(infoS.Get(c), ShouldBeNil) | 34 So(infoS.Get(c), ShouldBeNil) |
34 }) | 35 }) |
35 | 36 |
36 // needed for everything else | 37 // needed for everything else |
37 c = infoS.Set(c, Info()) | 38 c = infoS.Set(c, Info()) |
38 | 39 |
39 Convey("Info", func() { | 40 Convey("Info", func() { |
40 So(infoS.Get(c), ShouldNotBeNil) | 41 So(infoS.Get(c), ShouldNotBeNil) |
41 So(func() { | 42 So(func() { |
42 defer p() | 43 defer p() |
43 infoS.Get(c).Datacenter() | 44 infoS.Get(c).Datacenter() |
44 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") | 45 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") |
45 }) | 46 }) |
46 | 47 |
47 Convey("Datastore", func() { | 48 Convey("Datastore", func() { |
48 c = dsS.SetRaw(c, Datastore()) | 49 c = dsS.SetRaw(c, Datastore()) |
49 So(dsS.Get(c), ShouldNotBeNil) | 50 So(dsS.Get(c), ShouldNotBeNil) |
50 So(func() { | 51 So(func() { |
51 defer p() | 52 defer p() |
52 dsS.Get(c).DecodeKey("wut") | 53 dsS.Get(c).DecodeKey("wut") |
53 }, ShouldPanicWith, "dummy: method Datastore.DecodeKey i
s not implemented") | 54 }, ShouldPanicWith, "dummy: method Datastore.DecodeKey i
s not implemented") |
54 }) | 55 }) |
55 | 56 |
56 Convey("Memcache", func() { | 57 Convey("Memcache", func() { |
57 » » » c = mcS.Set(c, Memcache()) | 58 » » » c = mcS.SetRaw(c, Memcache()) |
58 So(mcS.Get(c), ShouldNotBeNil) | 59 So(mcS.Get(c), ShouldNotBeNil) |
59 So(func() { | 60 So(func() { |
60 defer p() | 61 defer p() |
61 mcS.Get(c).Add(nil) | 62 mcS.Get(c).Add(nil) |
62 » » » }, ShouldPanicWith, "dummy: method Memcache.Add is not i
mplemented") | 63 » » » }, ShouldPanicWith, "dummy: method Memcache.AddMulti is
not implemented") |
63 }) | 64 }) |
64 | 65 |
65 Convey("TaskQueue", func() { | 66 Convey("TaskQueue", func() { |
66 » » » c = tqS.Set(c, TaskQueue()) | 67 » » » c = tqS.SetRaw(c, TaskQueue()) |
67 So(tqS.Get(c), ShouldNotBeNil) | 68 So(tqS.Get(c), ShouldNotBeNil) |
68 So(func() { | 69 So(func() { |
69 defer p() | 70 defer p() |
70 tqS.Get(c).Purge("") | 71 tqS.Get(c).Purge("") |
71 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") | 72 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") |
72 }) | 73 }) |
73 | 74 |
74 }) | 75 }) |
75 } | 76 } |
OLD | NEW |