| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package hierarchy | 5 package hierarchy |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "testing" | 9 "testing" |
| 10 | 10 |
| 11 ds "github.com/luci/gae/service/datastore" | 11 ds "github.com/luci/gae/service/datastore" |
| 12 "github.com/luci/gae/service/info" | 12 "github.com/luci/gae/service/info" |
| 13 "github.com/luci/luci-go/appengine/logdog/coordinator" | 13 "github.com/luci/luci-go/appengine/logdog/coordinator" |
| 14 "github.com/luci/luci-go/appengine/logdog/coordinator/config" | |
| 15 ct "github.com/luci/luci-go/appengine/logdog/coordinator/coordinatorTest
" | 14 ct "github.com/luci/luci-go/appengine/logdog/coordinator/coordinatorTest
" |
| 16 luciConfig "github.com/luci/luci-go/common/config" | 15 luciConfig "github.com/luci/luci-go/common/config" |
| 17 "github.com/luci/luci-go/common/logdog/types" | 16 "github.com/luci/luci-go/common/logdog/types" |
| 18 | 17 |
| 19 . "github.com/smartystreets/goconvey/convey" | 18 . "github.com/smartystreets/goconvey/convey" |
| 20 ) | 19 ) |
| 21 | 20 |
| 22 func TestHierarchy(t *testing.T) { | 21 func TestHierarchy(t *testing.T) { |
| 23 t.Parallel() | 22 t.Parallel() |
| 24 | 23 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 So(l, lv.shouldHaveComponents) | 114 So(l, lv.shouldHaveComponents) |
| 116 So(l.Next, ShouldEqual, "") | 115 So(l.Next, ShouldEqual, "") |
| 117 }) | 116 }) |
| 118 }) | 117 }) |
| 119 }) | 118 }) |
| 120 | 119 |
| 121 Convey(`Get within a project that the user cannot access will re
turn ErrNoAccess.`, func() { | 120 Convey(`Get within a project that the user cannot access will re
turn ErrNoAccess.`, func() { |
| 122 r.Project = "proj-exclusive" | 121 r.Project = "proj-exclusive" |
| 123 | 122 |
| 124 _, err := Get(c, r) | 123 _, err := Get(c, r) |
| 125 » » » So(err, ShouldEqual, config.ErrNoAccess) | 124 » » » So(coordinator.IsMembershipError(err), ShouldBeTrue) |
| 126 }) | 125 }) |
| 127 | 126 |
| 128 Convey(`Get will return nothing when no components are registere
d.`, func() { | 127 Convey(`Get will return nothing when no components are registere
d.`, func() { |
| 129 r.Project = "proj-foo" | 128 r.Project = "proj-foo" |
| 130 lv.project = "proj-foo" | 129 lv.project = "proj-foo" |
| 131 | 130 |
| 132 So(get(), lv.shouldHaveComponents) | 131 So(get(), lv.shouldHaveComponents) |
| 133 | 132 |
| 134 r.PathBase = "foo" | 133 r.PathBase = "foo" |
| 135 lv.pathBase = "foo" | 134 lv.pathBase = "foo" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 func norm(c []*ListComponent) []string { | 294 func norm(c []*ListComponent) []string { |
| 296 result := make([]string, len(c)) | 295 result := make([]string, len(c)) |
| 297 for i, e := range c { | 296 for i, e := range c { |
| 298 result[i] = e.Name | 297 result[i] = e.Name |
| 299 if e.Stream { | 298 if e.Stream { |
| 300 result[i] += "$" | 299 result[i] += "$" |
| 301 } | 300 } |
| 302 } | 301 } |
| 303 return result | 302 return result |
| 304 } | 303 } |
| OLD | NEW |