| Index: luci_config/appengine/gaeconfig/settings_test.go
|
| diff --git a/luci_config/appengine/gaeconfig/settings_test.go b/luci_config/appengine/gaeconfig/settings_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..654479c5cbc9c8cb900ffd8b94723ba5519e00f2
|
| --- /dev/null
|
| +++ b/luci_config/appengine/gaeconfig/settings_test.go
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2017 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +package gaeconfig
|
| +
|
| +import (
|
| + "testing"
|
| +
|
| + "github.com/luci/luci-go/server/settings"
|
| +
|
| + "golang.org/x/net/context"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestSettingsURLToHostTranslation(t *testing.T) {
|
| + t.Parallel()
|
| +
|
| + Convey(`A testing settings configuration`, t, func() {
|
| + c := context.Background()
|
| +
|
| + memSettings := settings.MemoryStorage{}
|
| + c = settings.Use(c, settings.New(&memSettings))
|
| +
|
| + Convey(`Loaded with a URL value in ConfigServiceHost`, func() {
|
| + s := Settings{
|
| + ConfigServiceHost: "https://example.com/foo/bar",
|
| + }
|
| + So(s.SetIfChanged(c, "test harness", "initial settings"), ShouldBeNil)
|
| +
|
| + Convey(`Will load the setting as a host.`, func() {
|
| + s, err := FetchCachedSettings(c)
|
| + So(err, ShouldBeNil)
|
| + So(s, ShouldResemble, Settings{
|
| + ConfigServiceHost: "example.com",
|
| + })
|
| + })
|
| + })
|
| +
|
| + Convey(`Loaded with a host value in ConfigServiceHost`, func() {
|
| + s := Settings{
|
| + ConfigServiceHost: "example.com",
|
| + }
|
| + So(s.SetIfChanged(c, "test harness", "initial settings"), ShouldBeNil)
|
| +
|
| + Convey(`Will load the setting as a host.`, func() {
|
| + s, err := FetchCachedSettings(c)
|
| + So(err, ShouldBeNil)
|
| + So(s, ShouldResemble, Settings{
|
| + ConfigServiceHost: "example.com",
|
| + })
|
| + })
|
| + })
|
| + })
|
| +}
|
|
|