| 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" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 AnalyticsID string `json:"analytics_id"` | 98 AnalyticsID string `json:"analytics_id"` |
| 99 } | 99 } |
| 100 | 100 |
| 101 func TestPages(t *testing.T) { | 101 func TestPages(t *testing.T) { |
| 102 fixZeroDurationRE := regexp.MustCompile(`(Running for:|waiting) 0s?`) | 102 fixZeroDurationRE := regexp.MustCompile(`(Running for:|waiting) 0s?`) |
| 103 fixZeroDuration := func(text string) string { | 103 fixZeroDuration := func(text string) string { |
| 104 return fixZeroDurationRE.ReplaceAllLiteralString(text, "[ZERO DU
RATION]") | 104 return fixZeroDurationRE.ReplaceAllLiteralString(text, "[ZERO DU
RATION]") |
| 105 } | 105 } |
| 106 | 106 |
| 107 Convey("Testing basic rendering.", t, func() { | 107 Convey("Testing basic rendering.", t, func() { |
| 108 // Load all the bundles. | |
| 109 c := context.Background() | 108 c := context.Background() |
| 110 c = memory.Use(c) | 109 c = memory.Use(c) |
| 111 c = common.WithRequest(c, &http.Request{URL: &url.URL{Path: "/fo
obar"}}) | 110 c = common.WithRequest(c, &http.Request{URL: &url.URL{Path: "/fo
obar"}}) |
| 112 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) | 111 c, _ = testclock.UseTime(c, testclock.TestTimeUTC) |
| 113 a := auth.Authenticator{fakeOAuthMethod{"some_client_id"}} | 112 a := auth.Authenticator{fakeOAuthMethod{"some_client_id"}} |
| 114 c = auth.SetAuthenticator(c, a) | 113 c = auth.SetAuthenticator(c, a) |
| 115 c = settings.Use(c, settings.New(&settings.MemoryStorage{Expirat
ion: time.Second})) | 114 c = settings.Use(c, settings.New(&settings.MemoryStorage{Expirat
ion: time.Second})) |
| 116 err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345
-01"}, "", "") | 115 err := settings.Set(c, "analytics", &analyticsSettings{"UA-12345
-01"}, "", "") |
| 117 So(err, ShouldBeNil) | 116 So(err, ShouldBeNil) |
| 118 c = templates.Use(c, common.GetTemplateBundle()) | 117 c = templates.Use(c, common.GetTemplateBundle()) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 133 localBuf, err := load(fn
ame) | 132 localBuf, err := load(fn
ame) |
| 134 So(err, ShouldBeNil) | 133 So(err, ShouldBeNil) |
| 135 So(fixZeroDuration(strin
g(buf)), ShouldEqual, fixZeroDuration(string(localBuf))) | 134 So(fixZeroDuration(strin
g(buf)), ShouldEqual, fixZeroDuration(string(localBuf))) |
| 136 } | 135 } |
| 137 }) | 136 }) |
| 138 } | 137 } |
| 139 }) | 138 }) |
| 140 } | 139 } |
| 141 }) | 140 }) |
| 142 } | 141 } |
| OLD | NEW |