| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be 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 13 matching lines...) Expand all Loading... |
| 24 // p is a function which recovers an error and then immediately panics w
ith | 24 // p is a function which recovers an error and then immediately panics w
ith |
| 25 // the contained string. It's defer'd in each test so that we can use th
e | 25 // the contained string. It's defer'd in each test so that we can use th
e |
| 26 // ShouldPanicWith assertion (which does an == comparison and not | 26 // ShouldPanicWith assertion (which does an == comparison and not |
| 27 // a reflect.DeepEquals comparison). | 27 // a reflect.DeepEquals comparison). |
| 28 p := func() { panic(recover().(error).Error()) } | 28 p := func() { panic(recover().(error).Error()) } |
| 29 | 29 |
| 30 Convey("Context Access", t, func() { | 30 Convey("Context Access", t, func() { |
| 31 c := context.Background() | 31 c := context.Background() |
| 32 | 32 |
| 33 Convey("blank", func() { | 33 Convey("blank", func() { |
| 34 » » » So(dsS.GetRaw(c), ShouldBeNil) | 34 » » » So(dsS.Raw(c), ShouldBeNil) |
| 35 » » » So(mcS.GetRaw(c), ShouldBeNil) | 35 » » » So(mcS.Raw(c), ShouldBeNil) |
| 36 » » » So(tqS.GetRaw(c), ShouldBeNil) | 36 » » » So(tqS.Raw(c), ShouldBeNil) |
| 37 » » » So(infoS.Get(c), ShouldBeNil) | 37 » » » So(infoS.Raw(c), ShouldBeNil) |
| 38 }) | 38 }) |
| 39 | 39 |
| 40 // needed for everything else | 40 // needed for everything else |
| 41 c = infoS.Set(c, Info()) | 41 c = infoS.Set(c, Info()) |
| 42 | 42 |
| 43 Convey("Info", func() { | 43 Convey("Info", func() { |
| 44 » » » So(infoS.Get(c), ShouldNotBeNil) | 44 » » » So(infoS.Raw(c), ShouldNotBeNil) |
| 45 So(func() { | 45 So(func() { |
| 46 defer p() | 46 defer p() |
| 47 » » » » infoS.Get(c).Datacenter() | 47 » » » » infoS.Raw(c).Datacenter() |
| 48 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") | 48 }, ShouldPanicWith, "dummy: method Info.Datacenter is no
t implemented") |
| 49 }) | 49 }) |
| 50 | 50 |
| 51 Convey("Datastore", func() { | 51 Convey("Datastore", func() { |
| 52 c = dsS.SetRaw(c, Datastore()) | 52 c = dsS.SetRaw(c, Datastore()) |
| 53 » » » So(dsS.Get(c), ShouldNotBeNil) | 53 » » » So(dsS.Raw(c), ShouldNotBeNil) |
| 54 So(func() { | 54 So(func() { |
| 55 defer p() | 55 defer p() |
| 56 » » » » _, _ = dsS.Get(c).DecodeCursor("wut") | 56 » » » » _, _ = dsS.Raw(c).DecodeCursor("wut") |
| 57 }, ShouldPanicWith, "dummy: method Datastore.DecodeCurso
r is not implemented") | 57 }, ShouldPanicWith, "dummy: method Datastore.DecodeCurso
r is not implemented") |
| 58 }) | 58 }) |
| 59 | 59 |
| 60 Convey("Memcache", func() { | 60 Convey("Memcache", func() { |
| 61 c = mcS.SetRaw(c, Memcache()) | 61 c = mcS.SetRaw(c, Memcache()) |
| 62 » » » So(mcS.Get(c), ShouldNotBeNil) | 62 » » » So(mcS.Raw(c), ShouldNotBeNil) |
| 63 So(func() { | 63 So(func() { |
| 64 defer p() | 64 defer p() |
| 65 » » » » _ = mcS.Get(c).Add(nil) | 65 » » » » _ = mcS.Add(c, nil) |
| 66 }, ShouldPanicWith, "dummy: method Memcache.AddMulti is
not implemented") | 66 }, ShouldPanicWith, "dummy: method Memcache.AddMulti is
not implemented") |
| 67 }) | 67 }) |
| 68 | 68 |
| 69 Convey("TaskQueue", func() { | 69 Convey("TaskQueue", func() { |
| 70 c = tqS.SetRaw(c, TaskQueue()) | 70 c = tqS.SetRaw(c, TaskQueue()) |
| 71 » » » So(tqS.Get(c), ShouldNotBeNil) | 71 » » » So(tqS.Raw(c), ShouldNotBeNil) |
| 72 So(func() { | 72 So(func() { |
| 73 defer p() | 73 defer p() |
| 74 » » » » _ = tqS.Get(c).Purge("") | 74 » » » » _ = tqS.Purge(c, "") |
| 75 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") | 75 }, ShouldPanicWith, "dummy: method TaskQueue.Purge is no
t implemented") |
| 76 }) | 76 }) |
| 77 | 77 |
| 78 Convey("User", func() { | 78 Convey("User", func() { |
| 79 c = userS.Set(c, User()) | 79 c = userS.Set(c, User()) |
| 80 » » » So(userS.Get(c), ShouldNotBeNil) | 80 » » » So(userS.Raw(c), ShouldNotBeNil) |
| 81 So(func() { | 81 So(func() { |
| 82 defer p() | 82 defer p() |
| 83 » » » » _ = userS.Get(c).IsAdmin() | 83 » » » » _ = userS.IsAdmin(c) |
| 84 }, ShouldPanicWith, "dummy: method User.IsAdmin is not i
mplemented") | 84 }, ShouldPanicWith, "dummy: method User.IsAdmin is not i
mplemented") |
| 85 }) | 85 }) |
| 86 | 86 |
| 87 Convey("Mail", func() { | 87 Convey("Mail", func() { |
| 88 c = mailS.Set(c, Mail()) | 88 c = mailS.Set(c, Mail()) |
| 89 » » » So(mailS.Get(c), ShouldNotBeNil) | 89 » » » So(mailS.Raw(c), ShouldNotBeNil) |
| 90 So(func() { | 90 So(func() { |
| 91 defer p() | 91 defer p() |
| 92 » » » » _ = mailS.Get(c).Send(nil) | 92 » » » » _ = mailS.Send(c, nil) |
| 93 }, ShouldPanicWith, "dummy: method Mail.Send is not impl
emented") | 93 }, ShouldPanicWith, "dummy: method Mail.Send is not impl
emented") |
| 94 }) | 94 }) |
| 95 | 95 |
| 96 Convey("Module", func() { | 96 Convey("Module", func() { |
| 97 c = modS.Set(c, Module()) | 97 c = modS.Set(c, Module()) |
| 98 » » » So(modS.Get(c), ShouldNotBeNil) | 98 » » » So(modS.Raw(c), ShouldNotBeNil) |
| 99 So(func() { | 99 So(func() { |
| 100 defer p() | 100 defer p() |
| 101 » » » » modS.Get(c).List() | 101 » » » » modS.List(c) |
| 102 }, ShouldPanicWith, "dummy: method Module.List is not im
plemented") | 102 }, ShouldPanicWith, "dummy: method Module.List is not im
plemented") |
| 103 }) | 103 }) |
| 104 }) | 104 }) |
| 105 } | 105 } |
| OLD | NEW |