Make test to compile, they still fail.

This commit is contained in:
Mariano Cano 2019-11-14 18:07:16 -08:00
parent 43b663e0c3
commit 8585b29711
2 changed files with 9 additions and 14 deletions

View file

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

View file

@ -816,7 +816,7 @@ func TestRevoke(t *testing.T) {
for name, f := range tests {
tc := f()
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) {
switch v := err.(type) {
case *apiError: