| 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 machinetoken | 5 package machinetoken |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "crypto/x509/pkix" | 8 "crypto/x509/pkix" |
| 9 "math/big" | 9 "math/big" |
| 10 "testing" | 10 "testing" |
| 11 "time" | 11 "time" |
| 12 | 12 |
| 13 "github.com/luci/luci-go/common/clock" | 13 "github.com/luci/luci-go/common/clock" |
| 14 "github.com/luci/luci-go/common/clock/testclock" | 14 "github.com/luci/luci-go/common/clock/testclock" |
| 15 | 15 |
| 16 tokenserver "github.com/luci/luci-go/tokenserver/api" | 16 tokenserver "github.com/luci/luci-go/tokenserver/api" |
| 17 admin "github.com/luci/luci-go/tokenserver/api/admin/v1" | 17 admin "github.com/luci/luci-go/tokenserver/api/admin/v1" |
| 18 "github.com/luci/luci-go/tokenserver/appengine/impl/certconfig" | 18 "github.com/luci/luci-go/tokenserver/appengine/impl/certconfig" |
| 19 | 19 |
| 20 . "github.com/smartystreets/goconvey/convey" | 20 . "github.com/smartystreets/goconvey/convey" |
| 21 ) | 21 ) |
| 22 | 22 |
| 23 func TestInspectMachineTokenRPC(t *testing.T) { | 23 func TestInspectMachineTokenRPC(t *testing.T) { |
| 24 Convey("with mocked context", t, func() { | 24 Convey("with mocked context", t, func() { |
| 25 » » ctx := testingContext() | 25 » » ctx := testingContext(testingCA) |
| 26 impl := InspectMachineTokenRPC{ | 26 impl := InspectMachineTokenRPC{ |
| 27 Signer: testingSigner(), | 27 Signer: testingSigner(), |
| 28 } | 28 } |
| 29 tok := expectedLuciMachineToken | 29 tok := expectedLuciMachineToken |
| 30 | 30 |
| 31 Convey("Good token", func() { | 31 Convey("Good token", func() { |
| 32 reply, err := impl.InspectMachineToken(ctx, &admin.Inspe
ctMachineTokenRequest{ | 32 reply, err := impl.InspectMachineToken(ctx, &admin.Inspe
ctMachineTokenRequest{ |
| 33 TokenType: tokenserver.MachineTokenType_LUCI_MAC
HINE_TOKEN, | 33 TokenType: tokenserver.MachineTokenType_LUCI_MAC
HINE_TOKEN, |
| 34 Token: tok, | 34 Token: tok, |
| 35 }) | 35 }) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 IssuedAt: 1422936306, | 141 IssuedAt: 1422936306, |
| 142 Lifetime: 3600, | 142 Lifetime: 3600, |
| 143 CaId: 123, | 143 CaId: 123, |
| 144 CertSn: 4096, | 144 CertSn: 4096, |
| 145 }, | 145 }, |
| 146 }, | 146 }, |
| 147 }) | 147 }) |
| 148 }) | 148 }) |
| 149 }) | 149 }) |
| 150 } | 150 } |
| OLD | NEW |