| Index: server/config/naming_test.go
|
| diff --git a/server/config/naming_test.go b/server/config/naming_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ec514518887f1884a793208e94f05502e263dbbd
|
| --- /dev/null
|
| +++ b/server/config/naming_test.go
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2016 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 config
|
| +
|
| +import (
|
| + "testing"
|
| +
|
| + "github.com/luci/gae/impl/memory"
|
| +
|
| + "golang.org/x/net/context"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestNaming(t *testing.T) {
|
| + t.Parallel()
|
| +
|
| + Convey(`Testing naming utility methods`, t, func() {
|
| + So(ServiceConfigSet("my-service"), ShouldEqual, "services/my-service")
|
| + So(ProjectConfigSet("my-project"), ShouldEqual, "projects/my-project")
|
| +
|
| + project, configSet, tail := ParseProjectConfigSet("projects/foo")
|
| + So(project, ShouldEqual, "foo")
|
| + So(configSet, ShouldEqual, "projects/foo")
|
| + So(tail, ShouldEqual, "")
|
| +
|
| + project, configSet, tail = ParseProjectConfigSet("projects/foo/refs/heads/master")
|
| + So(project, ShouldEqual, "foo")
|
| + So(configSet, ShouldEqual, "projects/foo")
|
| + So(tail, ShouldEqual, "refs/heads/master")
|
| +
|
| + project, configSet, tail = ParseProjectConfigSet("not/a/project/config/set")
|
| + So(project, ShouldEqual, "")
|
| + So(configSet, ShouldEqual, "")
|
| + So(tail, ShouldEqual, "")
|
| +
|
| + Convey(`With a testing AppEngine context`, func() {
|
| + c := memory.Use(context.Background())
|
| +
|
| + Convey(`Can get the current service config set.`, func() {
|
| + So(CurrentServiceConfigSet(c), ShouldEqual, "services/app")
|
| + })
|
| + })
|
| + })
|
| +}
|
|
|