| 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 auth | 5 package auth |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "math/rand" | 8 "math/rand" |
| 9 "testing" | 9 "testing" |
| 10 "time" | 10 "time" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 . "github.com/smartystreets/goconvey/convey" | 22 . "github.com/smartystreets/goconvey/convey" |
| 23 ) | 23 ) |
| 24 | 24 |
| 25 type tokenMinterMock struct { | 25 type tokenMinterMock struct { |
| 26 request minter.MintDelegationTokenRequest | 26 request minter.MintDelegationTokenRequest |
| 27 response minter.MintDelegationTokenResponse | 27 response minter.MintDelegationTokenResponse |
| 28 err error | 28 err error |
| 29 } | 29 } |
| 30 | 30 |
| 31 func (m *tokenMinterMock) MintMachineToken(context.Context, *minter.MintMachineT
okenRequest, ...grpc.CallOption) (*minter.MintMachineTokenResponse, error) { | |
| 32 panic("not implemented") | |
| 33 } | |
| 34 | |
| 35 func (m *tokenMinterMock) MintDelegationToken(ctx context.Context, in *minter.Mi
ntDelegationTokenRequest, opts ...grpc.CallOption) (*minter.MintDelegationTokenR
esponse, error) { | 31 func (m *tokenMinterMock) MintDelegationToken(ctx context.Context, in *minter.Mi
ntDelegationTokenRequest, opts ...grpc.CallOption) (*minter.MintDelegationTokenR
esponse, error) { |
| 36 m.request = *in | 32 m.request = *in |
| 37 if m.err != nil { | 33 if m.err != nil { |
| 38 return nil, m.err | 34 return nil, m.err |
| 39 } | 35 } |
| 40 return &m.response, nil | 36 return &m.response, nil |
| 41 } | 37 } |
| 42 | 38 |
| 43 func TestMintDelegationToken(t *testing.T) { | 39 func TestMintDelegationToken(t *testing.T) { |
| 44 t.Parallel() | 40 t.Parallel() |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 So(mockedClient.request, ShouldResemble, minter.MintDele
gationTokenRequest{ | 129 So(mockedClient.request, ShouldResemble, minter.MintDele
gationTokenRequest{ |
| 134 DelegatedIdentity: "user:abc@example.com", | 130 DelegatedIdentity: "user:abc@example.com", |
| 135 ValidityDuration: 10800, | 131 ValidityDuration: 10800, |
| 136 Audience: []string{"REQUESTOR"}, | 132 Audience: []string{"REQUESTOR"}, |
| 137 Services: []string{"*"}, | 133 Services: []string{"*"}, |
| 138 Intent: "intent", | 134 Intent: "intent", |
| 139 }) | 135 }) |
| 140 }) | 136 }) |
| 141 }) | 137 }) |
| 142 } | 138 } |
| OLD | NEW |