| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 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 frontend | 5 package frontend |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "flag" | 8 "flag" |
| 9 "fmt" | 9 "fmt" |
| 10 "io/ioutil" | 10 "io/ioutil" |
| 11 "net/http" | 11 "net/http" |
| 12 "net/url" | 12 "net/url" |
| 13 "path/filepath" | 13 "path/filepath" |
| 14 "regexp" | 14 "regexp" |
| 15 "strings" | 15 "strings" |
| 16 "testing" | 16 "testing" |
| 17 "time" | 17 "time" |
| 18 | 18 |
| 19 "golang.org/x/net/context" | 19 "golang.org/x/net/context" |
| 20 | 20 |
| 21 "github.com/luci/gae/impl/memory" | 21 "github.com/luci/gae/impl/memory" |
| 22 "github.com/luci/luci-go/common/clock/testclock" | 22 "github.com/luci/luci-go/common/clock/testclock" |
| 23 "github.com/luci/luci-go/milo/appengine/common" | 23 "github.com/luci/luci-go/milo/appengine/common" |
| 24 » "github.com/luci/luci-go/milo/appengine/swarming" | 24 » "github.com/luci/luci-go/milo/appengine/job_source/swarming" |
| 25 "github.com/luci/luci-go/server/auth" | 25 "github.com/luci/luci-go/server/auth" |
| 26 "github.com/luci/luci-go/server/auth/authtest" | 26 "github.com/luci/luci-go/server/auth/authtest" |
| 27 "github.com/luci/luci-go/server/auth/identity" | 27 "github.com/luci/luci-go/server/auth/identity" |
| 28 "github.com/luci/luci-go/server/settings" | 28 "github.com/luci/luci-go/server/settings" |
| 29 "github.com/luci/luci-go/server/templates" | 29 "github.com/luci/luci-go/server/templates" |
| 30 | 30 |
| 31 . "github.com/smartystreets/goconvey/convey" | 31 . "github.com/smartystreets/goconvey/convey" |
| 32 ) | 32 ) |
| 33 | 33 |
| 34 type testPackage struct { | 34 type testPackage struct { |
| 35 Data func() []common.TestBundle | 35 Data func() []common.TestBundle |
| 36 DisplayName string | 36 DisplayName string |
| 37 TemplateName string | 37 TemplateName string |
| 38 } | 38 } |
| 39 | 39 |
| 40 var ( | 40 var ( |
| 41 allPackages = []testPackage{ | 41 allPackages = []testPackage{ |
| 42 {buildbotBuildTestData, "buildbot.build", "build.html"}, | 42 {buildbotBuildTestData, "buildbot.build", "build.html"}, |
| 43 {buildbotBuilderTestData, "buildbot.builder", "builder.html"}, | 43 {buildbotBuilderTestData, "buildbot.builder", "builder.html"}, |
| 44 » » {swarming.BuildTestData, "swarming.build", "build.html"}, | 44 » » {func() []common.TestBundle { |
| 45 » » » return swarming.BuildTestData("../job_source/swarming") |
| 46 » » }, "swarming.build", "build.html"}, |
| 45 {swarming.LogTestData, "swarming.log", "log.html"}, | 47 {swarming.LogTestData, "swarming.log", "log.html"}, |
| 46 {frontpageTestData, "frontpage", "frontpage.html"}, | 48 {frontpageTestData, "frontpage", "frontpage.html"}, |
| 47 } | 49 } |
| 48 ) | 50 ) |
| 49 | 51 |
| 50 var generate = flag.Bool( | 52 var generate = flag.Bool( |
| 51 "test.generate", false, "Generate expectations instead of running tests.
") | 53 "test.generate", false, "Generate expectations instead of running tests.
") |
| 52 | 54 |
| 53 func expectFileName(name string) string { | 55 func expectFileName(name string) string { |
| 54 name = strings.Replace(name, " ", "_", -1) | 56 name = strings.Replace(name, " ", "_", -1) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 localBuf, err := load(fn
ame) | 112 localBuf, err := load(fn
ame) |
| 111 So(err, ShouldBeNil) | 113 So(err, ShouldBeNil) |
| 112 So(fixZeroDuration(strin
g(buf)), ShouldEqual, fixZeroDuration(string(localBuf))) | 114 So(fixZeroDuration(strin
g(buf)), ShouldEqual, fixZeroDuration(string(localBuf))) |
| 113 } | 115 } |
| 114 }) | 116 }) |
| 115 } | 117 } |
| 116 }) | 118 }) |
| 117 } | 119 } |
| 118 }) | 120 }) |
| 119 } | 121 } |
| OLD | NEW |