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 logs | 5 package logs |
6 | 6 |
7 import ( | 7 import ( |
8 "fmt" | 8 "fmt" |
9 "testing" | 9 "testing" |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 Convey(`A project-level list request`, func() { | 81 Convey(`A project-level list request`, func() { |
82 req.Project = "" | 82 req.Project = "" |
83 | 83 |
84 // Only add project namespaces for some of our registere
d projects. | 84 // Only add project namespaces for some of our registere
d projects. |
85 // | 85 // |
86 // We add a project namespace to our datastore by creati
ng a single entity | 86 // We add a project namespace to our datastore by creati
ng a single entity |
87 // within that namespace. | 87 // within that namespace. |
88 addProjectNamespace := func(proj config.ProjectName) { | 88 addProjectNamespace := func(proj config.ProjectName) { |
89 c := c | 89 c := c |
90 » » » » if err := coordinator.WithProjectNamespaceNoAuth
(&c, proj); err != nil { | 90 » » » » if err := coordinator.WithProjectNamespace(&c, p
roj, coordinator.NamespaceAccessNoAuth); err != nil { |
91 panic(err) | 91 panic(err) |
92 } | 92 } |
93 | 93 |
94 entity := ds.PropertyMap{ | 94 entity := ds.PropertyMap{ |
95 "$id": []ds.Property{ds.MkProperty("wo
of")}, | 95 "$id": []ds.Property{ds.MkProperty("wo
of")}, |
96 "$kind": []ds.Property{ds.MkProperty("Do
g")}, | 96 "$kind": []ds.Property{ds.MkProperty("Do
g")}, |
97 } | 97 } |
98 if err := ds.Get(c).Put(entity); err != nil { | 98 if err := ds.Get(c).Put(entity); err != nil { |
99 panic(err) | 99 panic(err) |
100 } | 100 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 }) | 200 }) |
201 | 201 |
202 Convey(`If the user can't access the project, will return Permis
sionDenied.`, func() { | 202 Convey(`If the user can't access the project, will return Permis
sionDenied.`, func() { |
203 req.Project = "proj-exclusive" | 203 req.Project = "proj-exclusive" |
204 | 204 |
205 _, err := svc.List(c, &req) | 205 _, err := svc.List(c, &req) |
206 So(err, ShouldBeRPCPermissionDenied) | 206 So(err, ShouldBeRPCPermissionDenied) |
207 }) | 207 }) |
208 }) | 208 }) |
209 } | 209 } |
OLD | NEW |