From a6edcd0a3def7326c03726b38c5b4f08124bccad Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Thu, 14 Nov 2019 18:07:16 -0800 Subject: [PATCH] Make test to compile, they still fail. --- authority/authorize_test.go | 21 ++++++++------------- authority/tls_test.go | 2 +- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/authority/authorize_test.go b/authority/authorize_test.go index 23a2983c..fa14caa0 100644 --- a/authority/authorize_test.go +++ b/authority/authorize_test.go @@ -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) { diff --git a/authority/tls_test.go b/authority/tls_test.go index cee44535..c5c7f8c1 100644 --- a/authority/tls_test.go +++ b/authority/tls_test.go @@ -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: