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

Unified Diff: server/auth/authtest/state.go

Issue 2413683004: token-server: Delegation config import, validation and evaluation. (Closed)
Patch Set: also check validity_duration Created 4 years, 2 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
« no previous file with comments | « no previous file | tokenserver/api/admin/v1/admin.proto » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/auth/authtest/state.go
diff --git a/server/auth/authtest/state.go b/server/auth/authtest/state.go
index 619b35b0a8bb3c8fcb1f81146a86ffcc905d5eb5..41650624b6ccc0fb24d37cbdb718e5922b5da7c1 100644
--- a/server/auth/authtest/state.go
+++ b/server/auth/authtest/state.go
@@ -33,6 +33,11 @@ type FakeState struct {
// Error if not nil is returned by IsMember checks.
Error error
+ // FakeDB is a mock authdb.DB implementation to use.
+ //
+ // If not nil, overrides 'IdentityGroups' and 'Error'.
+ FakeDB authdb.DB
+
// PeerIdentityOverride may be set for PeerIdentity() to return custom value.
//
// By default PeerIdentity() returns Identity (i.e. no delegation is
@@ -49,6 +54,9 @@ var _ auth.State = (*FakeState)(nil)
// DB is part of State interface.
func (s *FakeState) DB() authdb.DB {
+ if s.FakeDB != nil {
+ return s.FakeDB
+ }
return &FakeErroringDB{
FakeDB: FakeDB{s.User().Identity: s.IdentityGroups},
Error: s.Error,
« no previous file with comments | « no previous file | tokenserver/api/admin/v1/admin.proto » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698