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

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: fix tests 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 type fakeRPCClient struct { 86 type fakeRPCClient struct {
87 In minter.MintMachineTokenRequest 87 In minter.MintMachineTokenRequest
88 Out minter.MintMachineTokenResponse 88 Out minter.MintMachineTokenResponse
89 } 89 }
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 ) {
97 panic("not implemented")
98 }
99
100 // fakeSigner implements Signer. 96 // fakeSigner implements Signer.
101 type fakeSigner struct{} 97 type fakeSigner struct{}
102 98
103 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) { 99 func (f *fakeSigner) Algo(ctx context.Context) (x509.SignatureAlgorithm, error) {
104 return x509.SHA256WithRSA, nil 100 return x509.SHA256WithRSA, nil
105 } 101 }
106 102
107 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) { 103 func (f *fakeSigner) Certificate(ctx context.Context) ([]byte, error) {
108 return []byte("fake certificate"), nil 104 return []byte("fake certificate"), nil
109 } 105 }
110 106
111 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) { 107 func (f *fakeSigner) Sign(ctx context.Context, blob []byte) ([]byte, error) {
112 return []byte("fake signature"), nil 108 return []byte("fake signature"), nil
113 } 109 }
OLDNEW
« tokenserver/api/oauth_token_grant.proto ('K') | « tokenserver/client/tokenclient.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698