forked from TrueCloudLab/certificates
Fix tests.
This commit is contained in:
parent
a3e2b4a552
commit
b9530909a4
1 changed files with 2 additions and 24 deletions
|
@ -19,7 +19,6 @@ import (
|
||||||
"github.com/smallstep/cli/crypto/tlsutil"
|
"github.com/smallstep/cli/crypto/tlsutil"
|
||||||
"github.com/smallstep/cli/crypto/x509util"
|
"github.com/smallstep/cli/crypto/x509util"
|
||||||
"github.com/smallstep/cli/jose"
|
"github.com/smallstep/cli/jose"
|
||||||
stepx509 "github.com/smallstep/cli/pkg/x509"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -124,20 +123,6 @@ func TestSign(t *testing.T) {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"fail convert csr to step format": func(t *testing.T) *signTest {
|
|
||||||
csr := getCSR(t, priv)
|
|
||||||
csr.Raw = []byte("foo")
|
|
||||||
return &signTest{
|
|
||||||
auth: a,
|
|
||||||
csr: csr,
|
|
||||||
extraOpts: extraOpts,
|
|
||||||
signOpts: signOpts,
|
|
||||||
err: &apiError{errors.New("sign: error converting x509 csr to stepx509 csr"),
|
|
||||||
http.StatusInternalServerError,
|
|
||||||
context{"csr": csr, "signOptions": signOpts},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"fail merge default ASN1DN": func(t *testing.T) *signTest {
|
"fail merge default ASN1DN": func(t *testing.T) *signTest {
|
||||||
_a := testAuthority(t)
|
_a := testAuthority(t)
|
||||||
_a.config.AuthorityConfig.Template = nil
|
_a.config.AuthorityConfig.Template = nil
|
||||||
|
@ -335,13 +320,6 @@ func TestRenew(t *testing.T) {
|
||||||
err *apiError
|
err *apiError
|
||||||
}
|
}
|
||||||
tests := map[string]func() (*renewTest, error){
|
tests := map[string]func() (*renewTest, error){
|
||||||
"fail-conversion-stepx509": func() (*renewTest, error) {
|
|
||||||
return &renewTest{
|
|
||||||
crt: &x509.Certificate{Raw: []byte("foo")},
|
|
||||||
err: &apiError{errors.New("error converting x509.Certificate to stepx509.Certificate"),
|
|
||||||
http.StatusInternalServerError, context{}},
|
|
||||||
}, nil
|
|
||||||
},
|
|
||||||
"fail-create-cert": func() (*renewTest, error) {
|
"fail-create-cert": func() (*renewTest, error) {
|
||||||
_a := testAuthority(t)
|
_a := testAuthority(t)
|
||||||
_a.intermediateIdentity.Key = nil
|
_a.intermediateIdentity.Key = nil
|
||||||
|
@ -373,7 +351,7 @@ func TestRenew(t *testing.T) {
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
newRootBytes, err := newRootProfile.CreateCertificate()
|
newRootBytes, err := newRootProfile.CreateCertificate()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
newRootCrt, err := stepx509.ParseCertificate(newRootBytes)
|
newRootCrt, err := x509.ParseCertificate(newRootBytes)
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
|
|
||||||
newIntermediateProfile, err := x509util.NewIntermediateProfile("new-intermediate",
|
newIntermediateProfile, err := x509util.NewIntermediateProfile("new-intermediate",
|
||||||
|
@ -381,7 +359,7 @@ func TestRenew(t *testing.T) {
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
newIntermediateBytes, err := newIntermediateProfile.CreateCertificate()
|
newIntermediateBytes, err := newIntermediateProfile.CreateCertificate()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
newIntermediateCrt, err := stepx509.ParseCertificate(newIntermediateBytes)
|
newIntermediateCrt, err := x509.ParseCertificate(newIntermediateBytes)
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
|
|
||||||
_a := testAuthority(t)
|
_a := testAuthority(t)
|
||||||
|
|
Loading…
Reference in a new issue