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

Unified Diff: milo/buildsource/buildbot/html_test.go

Issue 2977863002: [milo] Refactor all html knowledge out of backends. (Closed)
Patch Set: now with case insensitivity Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « milo/buildsource/buildbot/html.go ('k') | milo/buildsource/buildbot/master.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/buildsource/buildbot/html_test.go
diff --git a/milo/buildsource/buildbot/html_test.go b/milo/buildsource/buildbot/html_test.go
deleted file mode 100644
index e8be3f6170da7faad38910a57f7525a478849de5..0000000000000000000000000000000000000000
--- a/milo/buildsource/buildbot/html_test.go
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2017 The LUCI Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package buildbot
-
-import (
- "net/http"
- "net/http/httptest"
- "net/url"
- "testing"
-
- "golang.org/x/net/context"
-
- "github.com/julienschmidt/httprouter"
- "github.com/luci/gae/impl/memory"
- "github.com/luci/luci-go/common/clock/testclock"
- "github.com/luci/luci-go/milo/common"
- "github.com/luci/luci-go/server/auth"
- "github.com/luci/luci-go/server/auth/authtest"
- "github.com/luci/luci-go/server/auth/identity"
- "github.com/luci/luci-go/server/router"
- "github.com/luci/luci-go/server/templates"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func request(c context.Context, params map[string]string) *router.Context {
- p := httprouter.Params{}
- for k, v := range params {
- p = append(p, httprouter.Param{Key: k, Value: v})
- }
- r := &http.Request{URL: &url.URL{Path: "/foobar"}}
- c = common.WithRequest(c, r)
- w := httptest.NewRecorder()
- return &router.Context{
- Context: c,
- Params: p,
- Writer: w,
- Request: r,
- }
-}
-
-func TestHtml(t *testing.T) {
- c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
- c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
- c = templates.Use(c, common.GetTemplateBundle("../../frontend/appengine/templates"))
- c = auth.WithState(c, &authtest.FakeState{Identity: identity.AnonymousIdentity})
- putDSMasterJSON(c, &buildbotMaster{
- Name: "fake",
- Builders: map[string]*buildbotBuilder{"fake": {}},
- }, false)
-
- Convey(`HTML handler tests`, t, func() {
- Convey(`Build pages`, func() {
- Convey(`Empty request`, func() {
- rc := request(c, nil)
- BuildHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- Convey(`Missing builder`, func() {
- rc := request(c, map[string]string{"master": "foo"})
- BuildHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- Convey(`Missing build`, func() {
- rc := request(c, map[string]string{"master": "foo", "builder": "bar"})
- BuildHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- Convey(`Invalid build number`, func() {
- rc := request(c, map[string]string{"master": "foo", "builder": "bar", "build": "baz"})
- BuildHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- })
-
- Convey(`Builder pages`, func() {
- Convey(`Empty request`, func() {
- rc := request(c, nil)
- BuilderHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- Convey(`Missing builder`, func() {
- rc := request(c, map[string]string{"master": "foo"})
- BuilderHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusBadRequest)
- })
- Convey(`Builder not found`, func() {
- rc := request(c, map[string]string{"master": "fake", "builder": "newline"})
- BuilderHandler(rc)
- response := rc.Writer.(*httptest.ResponseRecorder)
- So(response.Code, ShouldEqual, http.StatusNotFound)
- })
- })
- })
-}
« no previous file with comments | « milo/buildsource/buildbot/html.go ('k') | milo/buildsource/buildbot/master.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698