Make test to compile, they still fail.

pull/166/head^2
Mariano Cano 5 years ago committed by max furman
parent 000885dea7
commit a6edcd0a3d

@ -7,10 +7,9 @@ import (
"testing" "testing"
"time" "time"
"github.com/smallstep/certificates/authority/provisioner"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/smallstep/assert" "github.com/smallstep/assert"
"github.com/smallstep/certificates/authority/provisioner"
"github.com/smallstep/cli/crypto/pemutil" "github.com/smallstep/cli/crypto/pemutil"
"github.com/smallstep/cli/crypto/randutil" "github.com/smallstep/cli/crypto/randutil"
"github.com/smallstep/cli/jose" "github.com/smallstep/cli/jose"
@ -272,9 +271,10 @@ func TestAuthority_authorizeRevoke(t *testing.T) {
validAudience := []string{"https://test.ca.smallstep.com/revoke"} validAudience := []string{"https://test.ca.smallstep.com/revoke"}
type authorizeTest struct { type authorizeTest struct {
auth *Authority auth *Authority
opts *RevokeOptions token string
err error opts *RevokeOptions
err error
} }
tests := map[string]func(t *testing.T) *authorizeTest{ tests := map[string]func(t *testing.T) *authorizeTest{
"fail/token/invalid-ott": func(t *testing.T) *authorizeTest { "fail/token/invalid-ott": func(t *testing.T) *authorizeTest {
@ -349,17 +349,12 @@ func TestAuthority_authorizeRevoke(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
tc := genTestCase(t) tc := genTestCase(t)
p, err := tc.auth.authorizeRevoke(tc.opts) if err := tc.auth.authorizeRevoke(context.TODO(), tc.token); err != nil {
if err != nil {
if assert.NotNil(t, tc.err) { if assert.NotNil(t, tc.err) {
assert.HasPrefix(t, err.Error(), tc.err.Error()) assert.HasPrefix(t, err.Error(), tc.err.Error())
} }
} else { } else {
if assert.Nil(t, tc.err) { assert.Nil(t, tc.err)
if assert.NotNil(t, p) {
assert.Equals(t, p.GetID(), "step-cli:4UELJx8e0aS9m0CH3fZ0EB7D5aUPICb759zALHFejvc")
}
}
} }
}) })
} }
@ -640,7 +635,7 @@ func TestAuthority_authorizeRenewal(t *testing.T) {
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
tc := genTestCase(t) tc := genTestCase(t)
err := tc.auth.authorizeRenewal(tc.crt) err := tc.auth.authorizeRenew(tc.crt)
if err != nil { if err != nil {
if assert.NotNil(t, tc.err) { if assert.NotNil(t, tc.err) {
switch v := err.(type) { switch v := err.(type) {

@ -816,7 +816,7 @@ func TestRevoke(t *testing.T) {
for name, f := range tests { for name, f := range tests {
tc := f() tc := f()
t.Run(name, func(t *testing.T) { t.Run(name, func(t *testing.T) {
if err := tc.a.Revoke(tc.opts); err != nil { if err := tc.a.Revoke(context.TODO(), tc.opts); err != nil {
if assert.NotNil(t, tc.err) { if assert.NotNil(t, tc.err) {
switch v := err.(type) { switch v := err.(type) {
case *apiError: case *apiError:

Loading…
Cancel
Save