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

Unified Diff: milo/frontend/routes_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/frontend/routes.go ('k') | milo/frontend/view_build.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/frontend/routes_test.go
diff --git a/milo/frontend/main_test.go b/milo/frontend/routes_test.go
similarity index 68%
rename from milo/frontend/main_test.go
rename to milo/frontend/routes_test.go
index 8ab1736ac959fa8bb050efb1dfba303cc9df1c8d..694b6252202d4e45092e64dbd5f987d675679a55 100644
--- a/milo/frontend/main_test.go
+++ b/milo/frontend/routes_test.go
@@ -30,6 +30,8 @@ import (
"github.com/luci/gae/impl/memory"
"github.com/luci/luci-go/common/clock/testclock"
+ "github.com/luci/luci-go/milo/api/resp"
+ "github.com/luci/luci-go/milo/buildsource/buildbot"
"github.com/luci/luci-go/milo/buildsource/swarming"
"github.com/luci/luci-go/milo/common"
"github.com/luci/luci-go/server/auth"
@@ -98,13 +100,13 @@ func TestPages(t *testing.T) {
Convey("Testing basic rendering.", t, func() {
c := context.Background()
c = memory.Use(c)
- c = common.WithRequest(c, &http.Request{URL: &url.URL{Path: "/foobar"}})
+ c = withRequest(c, &http.Request{URL: &url.URL{Path: "/foobar"}})
c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
c = auth.WithState(c, &authtest.FakeState{Identity: identity.AnonymousIdentity})
c = settings.Use(c, settings.New(&settings.MemoryStorage{Expiration: time.Second}))
err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345-01"}, "", "")
So(err, ShouldBeNil)
- c = templates.Use(c, common.GetTemplateBundle("appengine/templates"))
+ c = templates.Use(c, getTemplateBundle("appengine/templates"))
for _, p := range allPackages {
Convey(fmt.Sprintf("Testing handler %q", p.DisplayName), func() {
for _, b := range p.Data() {
@@ -129,3 +131,63 @@ func TestPages(t *testing.T) {
}
})
}
+
+// buildbotBuildTestData returns sample test data for build pages.
+func buildbotBuildTestData() []common.TestBundle {
+ c := memory.Use(context.Background())
+ c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
+ bundles := []common.TestBundle{}
+ for _, tc := range buildbot.TestCases {
+ build, err := buildbot.DebugBuild(c, "../buildsource/buildbot", tc.Builder, tc.Build)
+ if err != nil {
+ panic(fmt.Errorf(
+ "Encountered error while building debug/%s/%s.\n%s",
+ tc.Builder, tc.Build, err))
+ }
+ bundles = append(bundles, common.TestBundle{
+ Description: fmt.Sprintf("Debug page: %s/%d", tc.Builder, tc.Build),
+ Data: templates.Args{
+ "Build": build,
+ },
+ })
+ }
+ return bundles
+}
+
+// buildbotBuilderTestData returns sample test data for builder pages.
+func buildbotBuilderTestData() []common.TestBundle {
+ l := resp.NewLink("Some current build", "https://some.url/path")
+ return []common.TestBundle{
+ {
+ Description: "Basic Test no builds",
+ Data: templates.Args{
+ "Builder": &resp.Builder{
+ Name: "Sample Builder",
+ },
+ },
+ },
+ {
+ Description: "Basic Test with builds",
+ Data: templates.Args{
+ "Builder": &resp.Builder{
+ Name: "Sample Builder",
+ MachinePool: &resp.MachinePool{
+ Total: 15,
+ Disconnected: 13,
+ Idle: 5,
+ Busy: 8,
+ },
+ CurrentBuilds: []*resp.BuildSummary{
+ {Link: l, Revision: "deadbeef"},
+ },
+ PendingBuilds: []*resp.BuildSummary{
+ {Link: l, Revision: "deadbeef"},
+ },
+ FinishedBuilds: []*resp.BuildSummary{
+ {Link: l, Revision: "deadbeef"},
+ },
+ },
+ },
+ },
+ }
+}
« no previous file with comments | « milo/frontend/routes.go ('k') | milo/frontend/view_build.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698