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

Side by Side Diff: impl/memory/info_test.go

Issue 2957413002: Info Memory: Implement dummy ServiceAccount() (Closed)
Patch Set: Created 3 years, 5 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 unified diff | Download patch
« impl/memory/info.go ('K') | « impl/memory/info.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 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 memory 5 package memory
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 9
10 "github.com/luci/gae/service/info" 10 "github.com/luci/gae/service/info"
11 "golang.org/x/net/context" 11 "golang.org/x/net/context"
12 12
13 . "github.com/smartystreets/goconvey/convey" 13 . "github.com/smartystreets/goconvey/convey"
14 ) 14 )
15 15
16 func TestMustNamespace(t *testing.T) { 16 func TestMustNamespace(t *testing.T) {
17 Convey("Testable interface works", t, func() { 17 Convey("Testable interface works", t, func() {
18 c := UseWithAppID(context.Background(), "dev~app-id") 18 c := UseWithAppID(context.Background(), "dev~app-id")
19 19
20 // Default value. 20 // Default value.
21 So(info.AppID(c), ShouldEqual, "app-id") 21 So(info.AppID(c), ShouldEqual, "app-id")
22 So(info.FullyQualifiedAppID(c), ShouldEqual, "dev~app-id") 22 So(info.FullyQualifiedAppID(c), ShouldEqual, "dev~app-id")
23 So(info.RequestID(c), ShouldEqual, "test-request-id") 23 So(info.RequestID(c), ShouldEqual, "test-request-id")
24 sa, err := info.ServiceAccount(c)
25 So(err, ShouldBeNil)
26 So(sa, ShouldEqual, "user@example.com")
24 27
25 // Setting to "override" applies to initial context. 28 // Setting to "override" applies to initial context.
26 c = info.GetTestable(c).SetRequestID("override") 29 c = info.GetTestable(c).SetRequestID("override")
27 So(info.RequestID(c), ShouldEqual, "override") 30 So(info.RequestID(c), ShouldEqual, "override")
28 31
29 // Derive inner context, "override" applies. 32 // Derive inner context, "override" applies.
30 c = info.MustNamespace(c, "valid_namespace_name") 33 c = info.MustNamespace(c, "valid_namespace_name")
31 So(info.RequestID(c), ShouldEqual, "override") 34 So(info.RequestID(c), ShouldEqual, "override")
32 }) 35 })
33 } 36 }
OLDNEW
« impl/memory/info.go ('K') | « impl/memory/info.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698