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

Side by Side Diff: server/auth/delegation_test.go

Issue 2785973002: token-server: Add protos for new API for generating service account tokens. (Closed)
Patch Set: more nits Created 3 years, 4 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. 1 // Copyright 2016 The LUCI Authors.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 20 matching lines...) Expand all
31 31
32 . "github.com/smartystreets/goconvey/convey" 32 . "github.com/smartystreets/goconvey/convey"
33 ) 33 )
34 34
35 type tokenMinterMock struct { 35 type tokenMinterMock struct {
36 request minter.MintDelegationTokenRequest 36 request minter.MintDelegationTokenRequest
37 response minter.MintDelegationTokenResponse 37 response minter.MintDelegationTokenResponse
38 err error 38 err error
39 } 39 }
40 40
41 func (m *tokenMinterMock) MintMachineToken(context.Context, *minter.MintMachineT okenRequest, ...grpc.CallOption) (*minter.MintMachineTokenResponse, error) {
42 panic("not implemented")
43 }
44
45 func (m *tokenMinterMock) MintDelegationToken(ctx context.Context, in *minter.Mi ntDelegationTokenRequest, opts ...grpc.CallOption) (*minter.MintDelegationTokenR esponse, error) { 41 func (m *tokenMinterMock) MintDelegationToken(ctx context.Context, in *minter.Mi ntDelegationTokenRequest, opts ...grpc.CallOption) (*minter.MintDelegationTokenR esponse, error) {
46 m.request = *in 42 m.request = *in
47 if m.err != nil { 43 if m.err != nil {
48 return nil, m.err 44 return nil, m.err
49 } 45 }
50 return &m.response, nil 46 return &m.response, nil
51 } 47 }
52 48
53 func TestMintDelegationToken(t *testing.T) { 49 func TestMintDelegationToken(t *testing.T) {
54 t.Parallel() 50 t.Parallel()
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 So(mockedClient.request, ShouldResemble, minter.MintDele gationTokenRequest{ 140 So(mockedClient.request, ShouldResemble, minter.MintDele gationTokenRequest{
145 DelegatedIdentity: "user:abc@example.com", 141 DelegatedIdentity: "user:abc@example.com",
146 ValidityDuration: 10800, 142 ValidityDuration: 10800,
147 Audience: []string{"REQUESTOR"}, 143 Audience: []string{"REQUESTOR"},
148 Services: []string{"*"}, 144 Services: []string{"*"},
149 Intent: "intent", 145 Intent: "intent",
150 }) 146 })
151 }) 147 })
152 }) 148 })
153 } 149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698