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

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

Issue 2302743002: Interface update, per-method Contexts. (Closed)
Patch Set: Lightning talk licenses. Created 4 years, 3 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
« no previous file with comments | « impl/cloud/info.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 cloud
6
7 import (
8 "fmt"
9 "strings"
10 "testing"
11
12 "github.com/luci/gae/service/info"
13
14 "golang.org/x/net/context"
15
16 . "github.com/luci/luci-go/common/testing/assertions"
17 . "github.com/smartystreets/goconvey/convey"
18 )
19
20 func TestInfo(t *testing.T) {
21 t.Parallel()
22
23 Convey(`A testing Info service`, t, func() {
24 const maxNamespaceLen = 100
25
26 c := useInfo(context.Background())
27
28 Convey(`Can set valid namespaces.`, func() {
29 for _, v := range []string{
30 "",
31 "test",
32 "0123456789-ABCDEFGHIJKLMNOPQRSTUVWXYZ.abcdefghi jklmnopqrstuvwxyz_",
33 strings.Repeat("X", maxNamespaceLen),
34 } {
35 Convey(fmt.Sprintf(`Rejects %q`, v), func() {
36 c, err := info.Namespace(c, v)
37 So(err, ShouldBeNil)
38 So(info.GetNamespace(c), ShouldEqual, v)
39 })
40 }
41 })
42
43 Convey(`Rejects invalid namespaces on the client.`, func() {
44 for _, v := range []string{
45 " ",
46 strings.Repeat("X", maxNamespaceLen+1),
47 } {
48 Convey(fmt.Sprintf(`Rejects %q`, v), func() {
49 _, err := info.Namespace(c, v)
50 So(err, ShouldErrLike, "does not match")
51 })
52 }
53 })
54 })
55 }
OLDNEW
« no previous file with comments | « impl/cloud/info.go ('k') | impl/dummy/dummy.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698