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

Unified Diff: milo/appengine/frontend/milo_test.go

Issue 2248893002: Settings page for analytics ID (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-go@master
Patch Set: y Created 4 years, 4 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
Index: milo/appengine/frontend/milo_test.go
diff --git a/milo/appengine/frontend/milo_test.go b/milo/appengine/frontend/milo_test.go
index 393952a79fa509f54b95df6230e7b232115ebb95..1387fc993328ea5a98dfc4edac90c02ca745b6d6 100644
--- a/milo/appengine/frontend/milo_test.go
+++ b/milo/appengine/frontend/milo_test.go
@@ -13,6 +13,7 @@ import (
"reflect"
"strings"
"testing"
+ "time"
"github.com/luci/gae/impl/memory"
"github.com/luci/luci-go/common/clock/testclock"
@@ -21,6 +22,7 @@ import (
"github.com/luci/luci-go/milo/appengine/swarming"
"github.com/luci/luci-go/server/auth"
"github.com/luci/luci-go/server/auth/identity"
+ luciSettings "github.com/luci/luci-go/server/settings"
. "github.com/smartystreets/goconvey/convey"
"golang.org/x/net/context"
)
@@ -83,6 +85,10 @@ func (m fakeOAuthMethod) LogoutURL(context.Context, string) (string, error) {
return "https://logout.url/", nil
}
+type analyticsSettings struct {
+ AnalyticsID string `json:"analytics_id"`
+}
+
func TestPages(t *testing.T) {
Convey("Testing basic rendering.", t, func() {
// Load all the bundles.
@@ -91,7 +97,9 @@ func TestPages(t *testing.T) {
c, _ = testclock.UseTime(c, testclock.TestTimeUTC)
a := auth.Authenticator{fakeOAuthMethod{"some_client_id"}}
c = auth.SetAuthenticator(c, a)
-
+ c = luciSettings.Use(c, luciSettings.New(&luciSettings.MemoryStorage{Expiration: time.Second}))
+ err := luciSettings.Set(c, "analytics", &analyticsSettings{"UA-12345-01"}, "", "")
+ So(err, ShouldBeNil)
for _, nb := range settings.GetTemplateBundles() {
Convey(fmt.Sprintf("Testing theme %q", nb.Name), func() {
err := nb.Bundle.EnsureLoaded(c)

Powered by Google App Engine
This is Rietveld 408576698