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

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

Issue 2058173003: [som] Add revision range exapansion. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: no-message:) 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/luci-go/appengine/gaetesting" 21 "github.com/luci/luci-go/appengine/gaetesting"
21 "github.com/luci/luci-go/common/clock" 22 "github.com/luci/luci-go/common/clock"
22 "github.com/luci/luci-go/common/clock/testclock" 23 "github.com/luci/luci-go/common/clock/testclock"
23 "github.com/luci/luci-go/server/auth" 24 "github.com/luci/luci-go/server/auth"
24 "github.com/luci/luci-go/server/auth/authtest" 25 "github.com/luci/luci-go/server/auth/authtest"
25 "golang.org/x/net/context" 26 "golang.org/x/net/context"
26 27
27 . "github.com/smartystreets/goconvey/convey" 28 . "github.com/smartystreets/goconvey/convey"
28 ) 29 )
29 30
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 So(err, ShouldBeNil) 355 So(err, ShouldBeNil)
355 356
356 So(ds.Get(tree), ShouldBeNil) 357 So(ds.Get(tree), ShouldBeNil)
357 So(tree.DisplayName, ShouldEqual, "Oak") 358 So(tree.DisplayName, ShouldEqual, "Oak")
358 So(tree.AlertStreams, ShouldResemble, []string{" thing"}) 359 So(tree.AlertStreams, ShouldResemble, []string{" thing"})
359 }) 360 })
360 361
361 }) 362 })
362 }) 363 })
363 } 364 }
365
366 func TestRevRangeHandler(t *testing.T) {
367 t.Parallel()
368
369 Convey("get rev range", t, func() {
370 Convey("ok", func() {
371 c := gaetesting.TestingContext()
372 w := httptest.NewRecorder()
373 c = urlfetch.Set(c, http.DefaultTransport)
374
375 getRevRangeHandler(c, w, makeGetRequest(),
376 makeParams("start", "123", "end", "456"))
377
378 So(w.Code, ShouldEqual, 301)
379 })
380 Convey("bad request", func() {
381 c := gaetesting.TestingContext()
382 w := httptest.NewRecorder()
383 c = urlfetch.Set(c, http.DefaultTransport)
384
385 getRevRangeHandler(c, w, makeGetRequest(), nil)
386
387 So(w.Code, ShouldEqual, 400)
388 })
389 })
390 }
OLDNEW
« no previous file with comments | « go/src/infra/appengine/sheriff-o-matic/main.go ('k') | go/src/infra/appengine/sheriff-o-matic/sheriff-o-matic.infra_testing » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698