| 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 delegation | 5 package delegation |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "testing" | 8 "testing" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 . "github.com/luci/luci-go/common/testing/assertions" | 23 . "github.com/luci/luci-go/common/testing/assertions" |
| 24 . "github.com/smartystreets/goconvey/convey" | 24 . "github.com/smartystreets/goconvey/convey" |
| 25 ) | 25 ) |
| 26 | 26 |
| 27 func TestDelegationConfigLoader(t *testing.T) { | 27 func TestDelegationConfigLoader(t *testing.T) { |
| 28 Convey("DelegationConfigLoader works", t, func() { | 28 Convey("DelegationConfigLoader works", t, func() { |
| 29 ctx := gaetesting.TestingContext() | 29 ctx := gaetesting.TestingContext() |
| 30 ctx, tc := testclock.UseTime(ctx, testclock.TestTimeUTC) | 30 ctx, tc := testclock.UseTime(ctx, testclock.TestTimeUTC) |
| 31 | 31 |
| 32 » » loader := DelegationConfigLoader() | 32 » » loader := delegationConfigLoader() |
| 33 | 33 |
| 34 // Put the initial copy into the datastore. | 34 // Put the initial copy into the datastore. |
| 35 cfg, err := loadConfig(` | 35 cfg, err := loadConfig(` |
| 36 rules { | 36 rules { |
| 37 name: "rule 1" | 37 name: "rule 1" |
| 38 requestor: "user:some-user@example.com" | 38 requestor: "user:some-user@example.com" |
| 39 target_service: "service:some-service" | 39 target_service: "service:some-service" |
| 40 allowed_to_impersonate: "group:some-group" | 40 allowed_to_impersonate: "group:some-group" |
| 41 allowed_audience: "REQUESTOR" | 41 allowed_audience: "REQUESTOR" |
| 42 max_validity_duration: 86400 | 42 max_validity_duration: 86400 |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 return c, nil | 332 return c, nil |
| 333 } | 333 } |
| 334 | 334 |
| 335 func makeSet(ident ...string) *identityset.Set { | 335 func makeSet(ident ...string) *identityset.Set { |
| 336 s, err := identityset.FromStrings(ident, nil) | 336 s, err := identityset.FromStrings(ident, nil) |
| 337 if err != nil { | 337 if err != nil { |
| 338 panic(err) | 338 panic(err) |
| 339 } | 339 } |
| 340 return s | 340 return s |
| 341 } | 341 } |
| OLD | NEW |