| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package config |
| 6 |
| 7 import ( |
| 8 "testing" |
| 9 |
| 10 "github.com/luci/gae/impl/memory" |
| 11 |
| 12 "golang.org/x/net/context" |
| 13 |
| 14 . "github.com/smartystreets/goconvey/convey" |
| 15 ) |
| 16 |
| 17 func TestNaming(t *testing.T) { |
| 18 t.Parallel() |
| 19 |
| 20 Convey(`Testing naming utility methods`, t, func() { |
| 21 So(ServiceConfigSet("my-service"), ShouldEqual, "services/my-ser
vice") |
| 22 So(ProjectConfigSet("my-project"), ShouldEqual, "projects/my-pro
ject") |
| 23 |
| 24 project, configSet, tail := ParseProjectConfigSet("projects/foo"
) |
| 25 So(project, ShouldEqual, "foo") |
| 26 So(configSet, ShouldEqual, "projects/foo") |
| 27 So(tail, ShouldEqual, "") |
| 28 |
| 29 project, configSet, tail = ParseProjectConfigSet("projects/foo/r
efs/heads/master") |
| 30 So(project, ShouldEqual, "foo") |
| 31 So(configSet, ShouldEqual, "projects/foo") |
| 32 So(tail, ShouldEqual, "refs/heads/master") |
| 33 |
| 34 project, configSet, tail = ParseProjectConfigSet("not/a/project/
config/set") |
| 35 So(project, ShouldEqual, "") |
| 36 So(configSet, ShouldEqual, "") |
| 37 So(tail, ShouldEqual, "") |
| 38 |
| 39 Convey(`With a testing AppEngine context`, func() { |
| 40 c := memory.Use(context.Background()) |
| 41 |
| 42 Convey(`Can get the current service config set.`, func()
{ |
| 43 So(CurrentServiceConfigSet(c), ShouldEqual, "ser
vices/app") |
| 44 }) |
| 45 }) |
| 46 }) |
| 47 } |
| OLD | NEW |