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

Unified Diff: milo/appengine/settings/acl_test.go

Issue 2748073006: Milo Refactor: Remove theme support (Closed)
Patch Set: Fix builder.html pointer Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: milo/appengine/settings/acl_test.go
diff --git a/milo/appengine/settings/acl_test.go b/milo/appengine/settings/acl_test.go
deleted file mode 100644
index fef50679669012eefc55d9fd5bc029d575a42645..0000000000000000000000000000000000000000
--- a/milo/appengine/settings/acl_test.go
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016 The LUCI Authors. All rights reserved.
-// Use of this source code is governed under the Apache License, Version 2.0
-// that can be found in the LICENSE file.
-
-package settings
-
-import (
- "testing"
-
- "github.com/luci/gae/impl/memory"
- memcfg "github.com/luci/luci-go/common/config/impl/memory"
- "github.com/luci/luci-go/common/logging/gologger"
- "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig"
- "github.com/luci/luci-go/server/auth"
- "github.com/luci/luci-go/server/auth/authtest"
- "github.com/luci/luci-go/server/auth/identity"
- "golang.org/x/net/context"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestACL(t *testing.T) {
- t.Parallel()
-
- Convey("Test Environment", t, func() {
- c := memory.UseWithAppID(context.Background(), "dev~luci-milo")
- c = gologger.StdConfig.Use(c)
-
- Convey("Set up projects", func() {
- c = testconfig.WithCommonClient(c, memcfg.New(aclConfgs))
- err := Update(c)
- So(err, ShouldBeNil)
-
- Convey("Anon wants to...", func() {
- c = auth.WithState(c, &authtest.FakeState{
- Identity: identity.AnonymousIdentity,
- IdentityGroups: []string{"all"},
- })
- Convey("Read public project", func() {
- ok, err := IsAllowed(c, "opensource")
- So(ok, ShouldEqual, true)
- So(err, ShouldBeNil)
- })
- Convey("Read private project", func() {
- ok, err := IsAllowed(c, "secret")
- So(ok, ShouldEqual, false)
- So(err, ShouldBeNil)
- })
-
- })
- Convey("alicebob@google.com wants to...", func() {
- c = auth.WithState(c, &authtest.FakeState{
- Identity: "user:alicebob@google.com",
- IdentityGroups: []string{"googlers", "all"},
- })
- Convey("Read private project", func() {
- ok, err := IsAllowed(c, "secret")
- So(ok, ShouldEqual, true)
- So(err, ShouldBeNil)
- })
- })
-
- Convey("eve@notgoogle.com wants to...", func() {
- c = auth.WithState(c, &authtest.FakeState{
- Identity: "user:eve@notgoogle.com",
- IdentityGroups: []string{"all"},
- })
- Convey("Read public project", func() {
- ok, err := IsAllowed(c, "opensource")
- So(ok, ShouldEqual, true)
- So(err, ShouldBeNil)
- })
- Convey("Read private project", func() {
- ok, err := IsAllowed(c, "secret")
- So(ok, ShouldEqual, false)
- So(err, ShouldBeNil)
- })
- })
- })
- })
-}
-
-var secretProjectCfg = `
-name: "secret"
-access: "group:googlers"
-`
-
-var publicProjectCfg = `
-name: "opensource"
-access: "group:all"
-`
-
-var aclConfgs = map[string]memcfg.ConfigSet{
- "projects/secret": {
- "project.cfg": secretProjectCfg,
- },
- "projects/opensource": {
- "project.cfg": publicProjectCfg,
- },
-}

Powered by Google App Engine
This is Rietveld 408576698