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

Side by Side Diff: tokenserver/client/tokenclient_test.go

Issue 2785973002: token-server: Add protos for new API for generating service account tokens. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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 client 5 package client
6 6
7 import ( 7 import (
8 "crypto/x509" 8 "crypto/x509"
9 "testing" 9 "testing"
10 "time" 10 "time"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 func (f *fakeRPCClient) MintMachineToken(ctx context.Context, in *minter.MintMac hineTokenRequest, opts ...grpc.CallOption) (*minter.MintMachineTokenResponse, er ror) { 91 func (f *fakeRPCClient) MintMachineToken(ctx context.Context, in *minter.MintMac hineTokenRequest, opts ...grpc.CallOption) (*minter.MintMachineTokenResponse, er ror) {
92 f.In = *in 92 f.In = *in
93 return &f.Out, nil 93 return &f.Out, nil
94 } 94 }
95 95
96 func (f *fakeRPCClient) MintDelegationToken(context.Context, *minter.MintDelegat ionTokenRequest, ...grpc.CallOption) (*minter.MintDelegationTokenResponse, error ) { 96 func (f *fakeRPCClient) MintDelegationToken(context.Context, *minter.MintDelegat ionTokenRequest, ...grpc.CallOption) (*minter.MintDelegationTokenResponse, error ) {
97 panic("not implemented") 97 panic("not implemented")
98 } 98 }
99 99
100 func (f *fakeRPCClient) MintOAuthTokenGrant(context.Context, *minter.MintOAuthTo kenGrantRequest, ...grpc.CallOption) (*minter.MintOAuthTokenGrantResponse, error ) {
101 panic("not implemented")
102 }
103
104 func (f *fakeRPCClient) MintOAuthTokenViaGrant(context.Context, *minter.MintOAut hTokenViaGrantRequest, ...grpc.CallOption) (*minter.MintOAuthTokenViaGrantRespon se, error) {
105 panic("not implemented")
106 }
107
100 // fakeSigner implements Signer. 108 // fakeSigner implements Signer.
101 type fakeSigner struct{} 109 type fakeSigner struct{}
102 110
103 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) { 111 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) {
104 return x509.SHA256WithRSA, nil 112 return x509.SHA256WithRSA, nil
105 } 113 }
106 114
107 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) { 115 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) {
108 return []byte("fake certificate"), nil 116 return []byte("fake certificate"), nil
109 } 117 }
110 118
111 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) { 119 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) {
112 return []byte("fake signature"), nil 120 return []byte("fake signature"), nil
113 } 121 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698