| OLD | NEW |
| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 = lucicfg.SetImplementation(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") |
| 41 So(ok, ShouldEqual, true) | 41 So(ok, ShouldEqual, true) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |