Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: go/src/infra/appengine/sheriff-o-matic/main_test.go

Issue 2080243005: appengine, crimson: Use updated router API (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Rebase Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 som 5 package som
6 6
7 import ( 7 import (
8 "crypto/sha1" 8 "crypto/sha1"
9 "fmt" 9 "fmt"
10 "io/ioutil" 10 "io/ioutil"
11 "net/http" 11 "net/http"
12 "net/http/httptest" 12 "net/http/httptest"
13 "strings" 13 "strings"
14 "testing" 14 "testing"
15 "time" 15 "time"
16 16
17 "github.com/julienschmidt/httprouter" 17 "github.com/julienschmidt/httprouter"
18 18
19 "github.com/luci/gae/service/datastore" 19 "github.com/luci/gae/service/datastore"
20 "github.com/luci/gae/service/urlfetch" 20 "github.com/luci/gae/service/urlfetch"
21 "github.com/luci/luci-go/appengine/gaetesting" 21 "github.com/luci/luci-go/appengine/gaetesting"
22 "github.com/luci/luci-go/common/clock" 22 "github.com/luci/luci-go/common/clock"
23 "github.com/luci/luci-go/common/clock/testclock" 23 "github.com/luci/luci-go/common/clock/testclock"
24 "github.com/luci/luci-go/server/auth" 24 "github.com/luci/luci-go/server/auth"
25 "github.com/luci/luci-go/server/auth/authtest" 25 "github.com/luci/luci-go/server/auth/authtest"
26 "github.com/luci/luci-go/server/router"
26 "golang.org/x/net/context" 27 "golang.org/x/net/context"
27 28
28 . "github.com/smartystreets/goconvey/convey" 29 . "github.com/smartystreets/goconvey/convey"
29 ) 30 )
30 31
31 var _ = fmt.Printf 32 var _ = fmt.Printf
32 33
33 func TestMain(t *testing.T) { 34 func TestMain(t *testing.T) {
34 t.Parallel() 35 t.Parallel()
35 36
36 Convey("main", t, func() { 37 Convey("main", t, func() {
37 c := gaetesting.TestingContext() 38 c := gaetesting.TestingContext()
38 cl := testclock.New(testclock.TestTimeUTC) 39 cl := testclock.New(testclock.TestTimeUTC)
39 c = clock.Set(c, cl) 40 c = clock.Set(c, cl)
40 41
41 ds := datastore.Get(c) 42 ds := datastore.Get(c)
42 w := httptest.NewRecorder() 43 w := httptest.NewRecorder()
43 44
44 Convey("index", func() { 45 Convey("index", func() {
45 c = auth.SetAuthenticator(c, []auth.Method(nil)) 46 c = auth.SetAuthenticator(c, []auth.Method(nil))
46 47
47 Convey("anonymous", func() { 48 Convey("anonymous", func() {
48 » » » » indexPage(c, w, makeGetRequest(), makeParams("pa th", "chromium")) 49 » » » » indexPage(&router.Context{
50 » » » » » Context: c,
51 » » » » » Writer: w,
52 » » » » » Request: makeGetRequest(),
53 » » » » » Params: makeParams("path", "chromium"),
54 » » » » })
49 55
50 r, err := ioutil.ReadAll(w.Body) 56 r, err := ioutil.ReadAll(w.Body)
51 So(err, ShouldBeNil) 57 So(err, ShouldBeNil)
52 body := string(r) 58 body := string(r)
53 So(w.Code, ShouldEqual, 500) 59 So(w.Code, ShouldEqual, 500)
54 So(body, ShouldNotContainSubstring, "som-app") 60 So(body, ShouldNotContainSubstring, "som-app")
55 So(body, ShouldContainSubstring, "login") 61 So(body, ShouldContainSubstring, "login")
56 }) 62 })
57 63
58 c = auth.SetAuthenticator(c, []auth.Method{authtest.Fake Auth{ 64 c = auth.SetAuthenticator(c, []auth.Method{authtest.Fake Auth{
59 User: &auth.User{ 65 User: &auth.User{
60 Identity: "user:user@example.com", 66 Identity: "user:user@example.com",
61 }, 67 },
62 }}) 68 }})
63 authState := &authtest.FakeState{ 69 authState := &authtest.FakeState{
64 Identity: "user:user@example.com", 70 Identity: "user:user@example.com",
65 } 71 }
66 c = auth.WithState(c, authState) 72 c = auth.WithState(c, authState)
67 73
68 Convey("No access", func() { 74 Convey("No access", func() {
69 » » » » indexPage(c, w, makeGetRequest(), makeParams("pa th", "chromium")) 75 » » » » indexPage(&router.Context{
76 » » » » » Context: c,
77 » » » » » Writer: w,
78 » » » » » Request: makeGetRequest(),
79 » » » » » Params: makeParams("path", "chromium"),
80 » » » » })
70 81
71 So(w.Code, ShouldEqual, 200) 82 So(w.Code, ShouldEqual, 200)
72 r, err := ioutil.ReadAll(w.Body) 83 r, err := ioutil.ReadAll(w.Body)
73 So(err, ShouldBeNil) 84 So(err, ShouldBeNil)
74 body := string(r) 85 body := string(r)
75 So(body, ShouldNotContainSubstring, "som-app") 86 So(body, ShouldNotContainSubstring, "som-app")
76 So(body, ShouldContainSubstring, "Access denied" ) 87 So(body, ShouldContainSubstring, "Access denied" )
77 }) 88 })
78 authState.IdentityGroups = []string{authGroup} 89 authState.IdentityGroups = []string{authGroup}
79 90
80 Convey("good path", func() { 91 Convey("good path", func() {
81 » » » » indexPage(c, w, makeGetRequest(), makeParams("pa th", "chromium")) 92 » » » » indexPage(&router.Context{
93 » » » » » Context: c,
94 » » » » » Writer: w,
95 » » » » » Request: makeGetRequest(),
96 » » » » » Params: makeParams("path", "chromium"),
97 » » » » })
82 r, err := ioutil.ReadAll(w.Body) 98 r, err := ioutil.ReadAll(w.Body)
83 So(err, ShouldBeNil) 99 So(err, ShouldBeNil)
84 body := string(r) 100 body := string(r)
85 So(body, ShouldContainSubstring, "som-app") 101 So(body, ShouldContainSubstring, "som-app")
86 So(w.Code, ShouldEqual, 200) 102 So(w.Code, ShouldEqual, 200)
87 }) 103 })
88 }) 104 })
89 105
90 Convey("/api/v1", func() { 106 Convey("/api/v1", func() {
91 alertsIdx := datastore.IndexDefinition{ 107 alertsIdx := datastore.IndexDefinition{
92 Kind: "AlertsJSON", 108 Kind: "AlertsJSON",
93 Ancestor: true, 109 Ancestor: true,
94 SortBy: []datastore.IndexColumn{ 110 SortBy: []datastore.IndexColumn{
95 { 111 {
96 Property: "Date", 112 Property: "Date",
97 Descending: true, 113 Descending: true,
98 }, 114 },
99 }, 115 },
100 } 116 }
101 ds.Testable().AddIndexes(&alertsIdx) 117 ds.Testable().AddIndexes(&alertsIdx)
102 118
103 isGoogler := true 119 isGoogler := true
104 requireGoogler = func(w http.ResponseWriter, c context.C ontext) bool { 120 requireGoogler = func(w http.ResponseWriter, c context.C ontext) bool {
105 return isGoogler 121 return isGoogler
106 } 122 }
107 123
108 Convey("/trees", func() { 124 Convey("/trees", func() {
109 Convey("no trees yet", func() { 125 Convey("no trees yet", func() {
110 » » » » » getTreesHandler(c, w, makeGetRequest(), nil) 126 » » » » » getTreesHandler(&router.Context{
127 » » » » » » Context: c,
128 » » » » » » Writer: w,
129 » » » » » » Request: makeGetRequest(),
130 » » » » » })
111 131
112 r, err := ioutil.ReadAll(w.Body) 132 r, err := ioutil.ReadAll(w.Body)
113 So(err, ShouldBeNil) 133 So(err, ShouldBeNil)
114 body := string(r) 134 body := string(r)
115 So(w.Code, ShouldEqual, 200) 135 So(w.Code, ShouldEqual, 200)
116 So(body, ShouldEqual, "[]") 136 So(body, ShouldEqual, "[]")
117 }) 137 })
118 138
119 tree := &Tree{ 139 tree := &Tree{
120 Name: "oak", 140 Name: "oak",
121 DisplayName: "Oak", 141 DisplayName: "Oak",
122 } 142 }
123 So(ds.Put(tree), ShouldBeNil) 143 So(ds.Put(tree), ShouldBeNil)
124 ds.Testable().CatchupIndexes() 144 ds.Testable().CatchupIndexes()
125 145
126 Convey("basic tree", func() { 146 Convey("basic tree", func() {
127 » » » » » getTreesHandler(c, w, makeGetRequest(), nil) 147 » » » » » getTreesHandler(&router.Context{
148 » » » » » » Context: c,
149 » » » » » » Writer: w,
150 » » » » » » Request: makeGetRequest(),
151 » » » » » })
128 152
129 r, err := ioutil.ReadAll(w.Body) 153 r, err := ioutil.ReadAll(w.Body)
130 So(err, ShouldBeNil) 154 So(err, ShouldBeNil)
131 body := string(r) 155 body := string(r)
132 So(w.Code, ShouldEqual, 200) 156 So(w.Code, ShouldEqual, 200)
133 So(body, ShouldEqual, `[{"name":"oak","d isplay_name":"Oak"}]`) 157 So(body, ShouldEqual, `[{"name":"oak","d isplay_name":"Oak"}]`)
134 }) 158 })
135 }) 159 })
136 160
137 Convey("/alerts", func() { 161 Convey("/alerts", func() {
138 alerts := &AlertsJSON{ 162 alerts := &AlertsJSON{
139 Tree: ds.MakeKey("Tree", "oak"), 163 Tree: ds.MakeKey("Tree", "oak"),
140 Contents: []byte("hithere"), 164 Contents: []byte("hithere"),
141 } 165 }
142 Convey("GET", func() { 166 Convey("GET", func() {
143 Convey("no alerts yet", func() { 167 Convey("no alerts yet", func() {
144 » » » » » » getAlertsHandler(c, w, makeGetRe quest(), makeParams("tree", "oak")) 168 » » » » » » getAlertsHandler(&router.Context {
169 » » » » » » » Context: c,
170 » » » » » » » Writer: w,
171 » » » » » » » Request: makeGetRequest( ),
172 » » » » » » » Params: makeParams("tre e", "oak"),
173 » » » » » » })
145 174
146 r, err := ioutil.ReadAll(w.Body) 175 r, err := ioutil.ReadAll(w.Body)
147 So(err, ShouldBeNil) 176 So(err, ShouldBeNil)
148 body := string(r) 177 body := string(r)
149 So(w.Code, ShouldEqual, 404) 178 So(w.Code, ShouldEqual, 404)
150 So(body, ShouldContainSubstring, "Tree") 179 So(body, ShouldContainSubstring, "Tree")
151 }) 180 })
152 181
153 So(ds.Put(alerts), ShouldBeNil) 182 So(ds.Put(alerts), ShouldBeNil)
154 183
155 Convey("basic alerts", func() { 184 Convey("basic alerts", func() {
156 » » » » » » getAlertsHandler(c, w, makeGetRe quest(), makeParams("tree", "oak")) 185 » » » » » » getAlertsHandler(&router.Context {
186 » » » » » » » Context: c,
187 » » » » » » » Writer: w,
188 » » » » » » » Request: makeGetRequest( ),
189 » » » » » » » Params: makeParams("tre e", "oak"),
190 » » » » » » })
157 191
158 r, err := ioutil.ReadAll(w.Body) 192 r, err := ioutil.ReadAll(w.Body)
159 So(err, ShouldBeNil) 193 So(err, ShouldBeNil)
160 body := string(r) 194 body := string(r)
161 So(w.Code, ShouldEqual, 200) 195 So(w.Code, ShouldEqual, 200)
162 So(body, ShouldEqual, "hithere") 196 So(body, ShouldEqual, "hithere")
163 }) 197 })
164 }) 198 })
165 199
166 Convey("POST", func() { 200 Convey("POST", func() {
167 q := datastore.NewQuery("AlertsJSON") 201 q := datastore.NewQuery("AlertsJSON")
168 results := []*AlertsJSON{} 202 results := []*AlertsJSON{}
169 So(ds.GetAll(q, &results), ShouldBeNil) 203 So(ds.GetAll(q, &results), ShouldBeNil)
170 So(results, ShouldBeEmpty) 204 So(results, ShouldBeEmpty)
171 205
172 » » » » » postAlertsHandler(c, w, makePostRequest( `{"thing":"FOOBAR"}`), makeParams("tree", "oak")) 206 » » » » » postAlertsHandler(&router.Context{
207 » » » » » » Context: c,
208 » » » » » » Writer: w,
209 » » » » » » Request: makePostRequest(`{"thin g":"FOOBAR"}`),
210 » » » » » » Params: makeParams("tree", "oak "),
211 » » » » » })
173 212
174 r, err := ioutil.ReadAll(w.Body) 213 r, err := ioutil.ReadAll(w.Body)
175 So(err, ShouldBeNil) 214 So(err, ShouldBeNil)
176 body := string(r) 215 body := string(r)
177 So(w.Code, ShouldEqual, 200) 216 So(w.Code, ShouldEqual, 200)
178 So(body, ShouldEqual, "") 217 So(body, ShouldEqual, "")
179 218
180 ds.Testable().CatchupIndexes() 219 ds.Testable().CatchupIndexes()
181 results = []*AlertsJSON{} 220 results = []*AlertsJSON{}
182 So(ds.GetAll(q, &results), ShouldBeNil) 221 So(ds.GetAll(q, &results), ShouldBeNil)
183 So(results, ShouldHaveLength, 1) 222 So(results, ShouldHaveLength, 1)
184 itm := results[0] 223 itm := results[0]
185 So(itm.Tree, ShouldResemble, alerts.Tree ) 224 So(itm.Tree, ShouldResemble, alerts.Tree )
186 So(string(itm.Contents), ShouldEqual, `{ "date":"0001-02-03 04:05:06.000000007 +0000 UTC","thing":"FOOBAR"}`) 225 So(string(itm.Contents), ShouldEqual, `{ "date":"0001-02-03 04:05:06.000000007 +0000 UTC","thing":"FOOBAR"}`)
187 }) 226 })
188 }) 227 })
189 228
190 Convey("/annotations", func() { 229 Convey("/annotations", func() {
191 Convey("GET", func() { 230 Convey("GET", func() {
192 Convey("no annotations yet", func() { 231 Convey("no annotations yet", func() {
193 » » » » » » getAnnotationsHandler(c, w, make GetRequest(), nil) 232 » » » » » » getAnnotationsHandler(&router.Co ntext{
233 » » » » » » » Context: c,
234 » » » » » » » Writer: w,
235 » » » » » » » Request: makeGetRequest( ),
236 » » » » » » })
194 237
195 r, err := ioutil.ReadAll(w.Body) 238 r, err := ioutil.ReadAll(w.Body)
196 So(err, ShouldBeNil) 239 So(err, ShouldBeNil)
197 body := string(r) 240 body := string(r)
198 So(w.Code, ShouldEqual, 200) 241 So(w.Code, ShouldEqual, 200)
199 So(body, ShouldEqual, "[]") 242 So(body, ShouldEqual, "[]")
200 }) 243 })
201 244
202 ann := &Annotation{ 245 ann := &Annotation{
203 KeyDigest: fmt.Sprintf("% x", sha1.Sum([]byte("foobar"))), 246 KeyDigest: fmt.Sprintf("% x", sha1.Sum([]byte("foobar"))),
204 Key: "foobar", 247 Key: "foobar",
205 Bugs: []string{"hi", "bugz"}, 248 Bugs: []string{"hi", "bugz"},
206 SnoozeTime: 123123, 249 SnoozeTime: 123123,
207 ModificationTime: clock.Now(c).A dd(4 * time.Hour), 250 ModificationTime: clock.Now(c).A dd(4 * time.Hour),
208 } 251 }
209 So(ds.Put(ann), ShouldBeNil) 252 So(ds.Put(ann), ShouldBeNil)
210 ds.Testable().CatchupIndexes() 253 ds.Testable().CatchupIndexes()
211 254
212 Convey("basic annotation", func() { 255 Convey("basic annotation", func() {
213 » » » » » » getAnnotationsHandler(c, w, make GetRequest(), nil) 256 » » » » » » getAnnotationsHandler(&router.Co ntext{
257 » » » » » » » Context: c,
258 » » » » » » » Writer: w,
259 » » » » » » » Request: makeGetRequest( ),
260 » » » » » » })
214 261
215 r, err := ioutil.ReadAll(w.Body) 262 r, err := ioutil.ReadAll(w.Body)
216 So(err, ShouldBeNil) 263 So(err, ShouldBeNil)
217 body := string(r) 264 body := string(r)
218 So(w.Code, ShouldEqual, 200) 265 So(w.Code, ShouldEqual, 200)
219 So(body, ShouldEqual, `[{"KeyDig est":"8843d7f92416211de9ebb963ff4ce28125932878","key":"foobar","bugs":["hi","bug z"],"snoozeTime":123123,"ModificationTime":"0001-02-03T08:05:06Z"}]`) 266 So(body, ShouldEqual, `[{"KeyDig est":"8843d7f92416211de9ebb963ff4ce28125932878","key":"foobar","bugs":["hi","bug z"],"snoozeTime":123123,"ModificationTime":"0001-02-03T08:05:06Z"}]`)
220 }) 267 })
221 }) 268 })
222 Convey("POST", func() { 269 Convey("POST", func() {
223 Convey("invalid action", func() { 270 Convey("invalid action", func() {
224 » » » » » » postAnnotationsHandler(c, w, mak ePostRequest(""), makeParams("annKey", "foobar", "action", "lolwut")) 271 » » » » » » postAnnotationsHandler(&router.C ontext{
272 » » » » » » » Context: c,
273 » » » » » » » Writer: w,
274 » » » » » » » Request: makePostRequest (""),
275 » » » » » » » Params: makeParams("ann Key", "foobar", "action", "lolwut"),
276 » » » » » » })
225 277
226 So(w.Code, ShouldEqual, 404) 278 So(w.Code, ShouldEqual, 404)
227 }) 279 })
228 ann := &Annotation{ 280 ann := &Annotation{
229 Key: "foobar", 281 Key: "foobar",
230 KeyDigest: fmt.Sprintf("% x", sha1.Sum([]byte("foobar"))), 282 KeyDigest: fmt.Sprintf("% x", sha1.Sum([]byte("foobar"))),
231 ModificationTime: cl.Now(), 283 ModificationTime: cl.Now(),
232 } 284 }
233 cl.Add(time.Hour) 285 cl.Add(time.Hour)
234 286
235 Convey("add", func() { 287 Convey("add", func() {
236 change := `{"snoozeTime":123123} ` 288 change := `{"snoozeTime":123123} `
237 » » » » » » postAnnotationsHandler(c, w, mak ePostRequest(change), makeParams("annKey", "foobar", "action", "add")) 289 » » » » » » postAnnotationsHandler(&router.C ontext{
290 » » » » » » » Context: c,
291 » » » » » » » Writer: w,
292 » » » » » » » Request: makePostRequest (change),
293 » » » » » » » Params: makeParams("ann Key", "foobar", "action", "add"),
294 » » » » » » })
238 295
239 So(w.Code, ShouldEqual, 200) 296 So(w.Code, ShouldEqual, 200)
240 297
241 So(ds.Get(ann), ShouldBeNil) 298 So(ds.Get(ann), ShouldBeNil)
242 So(ann.SnoozeTime, ShouldEqual, 123123) 299 So(ann.SnoozeTime, ShouldEqual, 123123)
243 300
244 Convey("bad change", func() { 301 Convey("bad change", func() {
245 w = httptest.NewRecorder () 302 w = httptest.NewRecorder ()
246 » » » » » » » postAnnotationsHandler(c , w, makePostRequest(`{"bugs":["oooops"]}`), makeParams("annKey", "foobar", "act ion", "add")) 303 » » » » » » » postAnnotationsHandler(& router.Context{
304 » » » » » » » » Context: c,
305 » » » » » » » » Writer: w,
306 » » » » » » » » Request: makePos tRequest(`{"bugs":["oooops"]}`),
307 » » » » » » » » Params: makePar ams("annKey", "foobar", "action", "add"),
308 » » » » » » » })
247 309
248 So(w.Code, ShouldEqual, 400) 310 So(w.Code, ShouldEqual, 400)
249 311
250 So(ds.Get(ann), ShouldBe Nil) 312 So(ds.Get(ann), ShouldBe Nil)
251 So(ann.SnoozeTime, Shoul dEqual, 123123) 313 So(ann.SnoozeTime, Shoul dEqual, 123123)
252 So(ann.Bugs, ShouldBeNil ) 314 So(ann.Bugs, ShouldBeNil )
253 }) 315 })
254 }) 316 })
255 317
256 Convey("remove", func() { 318 Convey("remove", func() {
257 Convey("can't remove non-existan t annotation", func() { 319 Convey("can't remove non-existan t annotation", func() {
258 » » » » » » » postAnnotationsHandler(c , w, makePostRequest(""), makeParams("annKey", "foobar", "action", "remove")) 320 » » » » » » » postAnnotationsHandler(& router.Context{
321 » » » » » » » » Context: c,
322 » » » » » » » » Writer: w,
323 » » » » » » » » Request: makePos tRequest(""),
324 » » » » » » » » Params: makePar ams("annKey", "foobar", "action", "remove"),
325 » » » » » » » })
259 326
260 So(w.Code, ShouldEqual, 404) 327 So(w.Code, ShouldEqual, 404)
261 }) 328 })
262 329
263 ann.SnoozeTime = 123 330 ann.SnoozeTime = 123
264 So(ds.Put(ann), ShouldBeNil) 331 So(ds.Put(ann), ShouldBeNil)
265 332
266 Convey("basic", func() { 333 Convey("basic", func() {
267 So(ann.SnoozeTime, Shoul dEqual, 123) 334 So(ann.SnoozeTime, Shoul dEqual, 123)
268 335
269 » » » » » » » postAnnotationsHandler(c , w, makePostRequest(`{"snoozeTime":true}`), makeParams("annKey", "foobar", "act ion", "remove")) 336 » » » » » » » postAnnotationsHandler(& router.Context{
337 » » » » » » » » Context: c,
338 » » » » » » » » Writer: w,
339 » » » » » » » » Request: makePos tRequest(`{"snoozeTime":true}`),
340 » » » » » » » » Params: makePar ams("annKey", "foobar", "action", "remove"),
341 » » » » » » » })
342
270 So(w.Code, ShouldEqual, 200) 343 So(w.Code, ShouldEqual, 200)
271 So(ds.Get(ann), ShouldBe Nil) 344 So(ds.Get(ann), ShouldBe Nil)
272 So(ann.SnoozeTime, Shoul dEqual, 0) 345 So(ann.SnoozeTime, Shoul dEqual, 0)
273 }) 346 })
274 347
275 }) 348 })
276 }) 349 })
277 }) 350 })
278 }) 351 })
279 }) 352 })
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 438
366 func TestRevRangeHandler(t *testing.T) { 439 func TestRevRangeHandler(t *testing.T) {
367 t.Parallel() 440 t.Parallel()
368 441
369 Convey("get rev range", t, func() { 442 Convey("get rev range", t, func() {
370 Convey("ok", func() { 443 Convey("ok", func() {
371 c := gaetesting.TestingContext() 444 c := gaetesting.TestingContext()
372 w := httptest.NewRecorder() 445 w := httptest.NewRecorder()
373 c = urlfetch.Set(c, http.DefaultTransport) 446 c = urlfetch.Set(c, http.DefaultTransport)
374 447
375 » » » getRevRangeHandler(c, w, makeGetRequest(), 448 » » » getRevRangeHandler(&router.Context{
376 » » » » makeParams("start", "123", "end", "456")) 449 » » » » Context: c,
450 » » » » Writer: w,
451 » » » » Request: makeGetRequest(),
452 » » » » Params: makeParams("start", "123", "end", "456" ),
453 » » » })
377 454
378 So(w.Code, ShouldEqual, 301) 455 So(w.Code, ShouldEqual, 301)
379 }) 456 })
380 Convey("bad request", func() { 457 Convey("bad request", func() {
381 c := gaetesting.TestingContext() 458 c := gaetesting.TestingContext()
382 w := httptest.NewRecorder() 459 w := httptest.NewRecorder()
383 c = urlfetch.Set(c, http.DefaultTransport) 460 c = urlfetch.Set(c, http.DefaultTransport)
384 461
385 » » » getRevRangeHandler(c, w, makeGetRequest(), nil) 462 » » » getRevRangeHandler(&router.Context{
463 » » » » Context: c,
464 » » » » Writer: w,
465 » » » » Request: makeGetRequest(),
466 » » » })
386 467
387 So(w.Code, ShouldEqual, 400) 468 So(w.Code, ShouldEqual, 400)
388 }) 469 })
389 }) 470 })
390 } 471 }
OLDNEW
« no previous file with comments | « go/src/infra/appengine/sheriff-o-matic/main.go ('k') | go/src/infra/crimson/server/frontend/handler.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698