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

Side by Side Diff: milo/appengine/settings/acl_test.go

Issue 2575383002: Add server/cache support to gaeconfig. (Closed)
Patch Set: Un-collapse. Created 3 years, 11 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 | « milo/appengine/logdog/http.go ('k') | milo/appengine/settings/config.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The LUCI Authors. All rights reserved. 1 // Copyright 2016 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 settings 5 package settings
6 6
7 import ( 7 import (
8 "testing" 8 "testing"
9 9
10 "github.com/luci/gae/impl/memory" 10 "github.com/luci/gae/impl/memory"
11 lucicfg "github.com/luci/luci-go/common/config"
12 memcfg "github.com/luci/luci-go/common/config/impl/memory" 11 memcfg "github.com/luci/luci-go/common/config/impl/memory"
13 "github.com/luci/luci-go/common/logging/gologger" 12 "github.com/luci/luci-go/common/logging/gologger"
13 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig "
14 "github.com/luci/luci-go/server/auth" 14 "github.com/luci/luci-go/server/auth"
15 "github.com/luci/luci-go/server/auth/authtest" 15 "github.com/luci/luci-go/server/auth/authtest"
16 "github.com/luci/luci-go/server/auth/identity" 16 "github.com/luci/luci-go/server/auth/identity"
17 "golang.org/x/net/context" 17 "golang.org/x/net/context"
18 18
19 . "github.com/smartystreets/goconvey/convey" 19 . "github.com/smartystreets/goconvey/convey"
20 ) 20 )
21 21
22 func TestACL(t *testing.T) { 22 func TestACL(t *testing.T) {
23 t.Parallel() 23 t.Parallel()
24 24
25 Convey("Test Environment", t, func() { 25 Convey("Test Environment", t, func() {
26 c := memory.UseWithAppID(context.Background(), "dev~luci-milo") 26 c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
27 c = gologger.StdConfig.Use(c) 27 c = gologger.StdConfig.Use(c)
28 28
29 Convey("Set up projects", func() { 29 Convey("Set up projects", func() {
30 » » » c = lucicfg.SetImplementation(c, memcfg.New(aclConfgs)) 30 » » » c = testconfig.WithCommonClient(c, memcfg.New(aclConfgs) )
31 err := Update(c) 31 err := Update(c)
32 So(err, ShouldBeNil) 32 So(err, ShouldBeNil)
33 33
34 Convey("Anon wants to...", func() { 34 Convey("Anon wants to...", func() {
35 c = auth.WithState(c, &authtest.FakeState{ 35 c = auth.WithState(c, &authtest.FakeState{
36 Identity: identity.AnonymousIdenti ty, 36 Identity: identity.AnonymousIdenti ty,
37 IdentityGroups: []string{"all"}, 37 IdentityGroups: []string{"all"},
38 }) 38 })
39 Convey("Read public project", func() { 39 Convey("Read public project", func() {
40 ok, err := IsAllowed(c, "opensource") 40 ok, err := IsAllowed(c, "opensource")
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 ` 91 `
92 92
93 var aclConfgs = map[string]memcfg.ConfigSet{ 93 var aclConfgs = map[string]memcfg.ConfigSet{
94 "projects/secret.git": { 94 "projects/secret.git": {
95 "luci-milo.cfg": secretProjectCfg, 95 "luci-milo.cfg": secretProjectCfg,
96 }, 96 },
97 "projects/opensource.git": { 97 "projects/opensource.git": {
98 "luci-milo.cfg": publicProjectCfg, 98 "luci-milo.cfg": publicProjectCfg,
99 }, 99 },
100 } 100 }
OLDNEW
« no previous file with comments | « milo/appengine/logdog/http.go ('k') | milo/appengine/settings/config.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698