| 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 buildbot | 5 package buildbot |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "encoding/json" | 8 "encoding/json" |
| 9 "flag" | 9 "flag" |
| 10 "fmt" | 10 "fmt" |
| 11 "io/ioutil" | 11 "io/ioutil" |
| 12 "path" | 12 "path" |
| 13 "strings" | 13 "strings" |
| 14 "testing" | 14 "testing" |
| 15 | 15 |
| 16 "github.com/luci/gae/impl/memory" | 16 "github.com/luci/gae/impl/memory" |
| 17 ds "github.com/luci/gae/service/datastore" | 17 ds "github.com/luci/gae/service/datastore" |
| 18 "github.com/luci/luci-go/common/clock/testclock" | 18 "github.com/luci/luci-go/common/clock/testclock" |
| 19 memcfg "github.com/luci/luci-go/common/config/impl/memory" | 19 memcfg "github.com/luci/luci-go/common/config/impl/memory" |
| 20 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig
" | 20 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig
" |
| 21 "github.com/luci/luci-go/milo/common/miloerror" | |
| 22 "github.com/luci/luci-go/server/auth" | 21 "github.com/luci/luci-go/server/auth" |
| 23 "github.com/luci/luci-go/server/auth/authtest" | 22 "github.com/luci/luci-go/server/auth/authtest" |
| 24 "github.com/luci/luci-go/server/auth/identity" | 23 "github.com/luci/luci-go/server/auth/identity" |
| 25 | 24 |
| 26 "golang.org/x/net/context" | 25 "golang.org/x/net/context" |
| 27 | 26 |
| 28 . "github.com/smartystreets/goconvey/convey" | 27 . "github.com/smartystreets/goconvey/convey" |
| 29 ) | 28 ) |
| 30 | 29 |
| 31 var generate = flag.Bool("test.generate", false, "Generate expectations instead
of running tests.") | 30 var generate = flag.Bool("test.generate", false, "Generate expectations instead
of running tests.") |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 86 } |
| 88 | 87 |
| 89 Convey(`Disallow anonomyous users from accessing internal builds
`, func() { | 88 Convey(`Disallow anonomyous users from accessing internal builds
`, func() { |
| 90 ds.Put(c, &buildbotBuild{ | 89 ds.Put(c, &buildbotBuild{ |
| 91 Master: "fake", | 90 Master: "fake", |
| 92 Buildername: "fake", | 91 Buildername: "fake", |
| 93 Number: 1, | 92 Number: 1, |
| 94 Internal: true, | 93 Internal: true, |
| 95 }) | 94 }) |
| 96 _, err := getBuild(c, "fake", "fake", 1) | 95 _, err := getBuild(c, "fake", "fake", 1) |
| 97 » » » So(err, ShouldResemble, miloerror.Error{ | 96 » » » So(err, ShouldResemble, errNotAuth) |
| 98 » » » » Message: "You are not authenticated, try logging
in", | |
| 99 » » » » Code: 401, | |
| 100 » » » }) | |
| 101 }) | 97 }) |
| 102 }) | 98 }) |
| 103 } | 99 } |
| 104 | 100 |
| 105 var internalConfig = ` | 101 var internalConfig = ` |
| 106 name: "buildbot-internal" | 102 name: "buildbot-internal" |
| 107 access: "group:googlers" | 103 access: "group:googlers" |
| 108 ` | 104 ` |
| 109 | 105 |
| 110 var bbAclConfigs = map[string]memcfg.ConfigSet{ | 106 var bbAclConfigs = map[string]memcfg.ConfigSet{ |
| 111 "projects/chrome": { | 107 "projects/chrome": { |
| 112 "project.cfg": internalConfig, | 108 "project.cfg": internalConfig, |
| 113 }, | 109 }, |
| 114 } | 110 } |
| OLD | NEW |