Fix api tests.

This commit is contained in:
Mariano Cano 2019-03-07 13:15:07 -08:00
parent 507fd01062
commit aa8385b8ba

View file

@ -416,7 +416,7 @@ type mockAuthority struct {
root func(shasum string) (*x509.Certificate, error) root func(shasum string) (*x509.Certificate, error)
sign func(cr *x509.CertificateRequest, signOpts authority.SignOptions, extraOpts ...provisioner.SignOption) (*x509.Certificate, *x509.Certificate, error) sign func(cr *x509.CertificateRequest, signOpts authority.SignOptions, extraOpts ...provisioner.SignOption) (*x509.Certificate, *x509.Certificate, error)
renew func(cert *x509.Certificate) (*x509.Certificate, *x509.Certificate, error) renew func(cert *x509.Certificate) (*x509.Certificate, *x509.Certificate, error)
getProvisioners func(nextCursor string, limit int) ([]*provisioner.Provisioner, string, error) getProvisioners func(nextCursor string, limit int) (provisioner.List, string, error)
getEncryptedKey func(kid string) (string, error) getEncryptedKey func(kid string) (string, error)
getRoots func() ([]*x509.Certificate, error) getRoots func() ([]*x509.Certificate, error)
getFederation func() ([]*x509.Certificate, error) getFederation func() ([]*x509.Certificate, error)
@ -457,11 +457,11 @@ func (m *mockAuthority) Renew(cert *x509.Certificate) (*x509.Certificate, *x509.
return m.ret1.(*x509.Certificate), m.ret2.(*x509.Certificate), m.err return m.ret1.(*x509.Certificate), m.ret2.(*x509.Certificate), m.err
} }
func (m *mockAuthority) GetProvisioners(nextCursor string, limit int) ([]*provisioner.Provisioner, string, error) { func (m *mockAuthority) GetProvisioners(nextCursor string, limit int) (provisioner.List, string, error) {
if m.getProvisioners != nil { if m.getProvisioners != nil {
return m.getProvisioners(nextCursor, limit) return m.getProvisioners(nextCursor, limit)
} }
return m.ret1.([]*provisioner.Provisioner), m.ret2.(string), m.err return m.ret1.(provisioner.List), m.ret2.(string), m.err
} }
func (m *mockAuthority) GetEncryptedKey(kid string) (string, error) { func (m *mockAuthority) GetEncryptedKey(kid string) (string, error) {
@ -724,19 +724,19 @@ func Test_caHandler_Provisioners(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
p := []*provisioner.Provisioner{ p := provisioner.List{
provisioner.New(&provisioner.JWK{ &provisioner.JWK{
Type: "JWK", Type: "JWK",
Name: "max", Name: "max",
EncryptedKey: "abc", EncryptedKey: "abc",
Key: &key, Key: &key,
}), },
provisioner.New(&provisioner.JWK{ &provisioner.JWK{
Type: "JWK", Type: "JWK",
Name: "mariano", Name: "mariano",
EncryptedKey: "def", EncryptedKey: "def",
Key: &key, Key: &key,
}), },
} }
pr := ProvisionersResponse{ pr := ProvisionersResponse{
Provisioners: p, Provisioners: p,