2019-03-11 19:56:47 +00:00
|
|
|
package provisioner
|
|
|
|
|
|
|
|
import (
|
2019-07-30 01:24:34 +00:00
|
|
|
"context"
|
2019-03-11 19:56:47 +00:00
|
|
|
"crypto/x509"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/smallstep/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func Test_noop(t *testing.T) {
|
|
|
|
p := noop{}
|
|
|
|
assert.Equals(t, "noop", p.GetID())
|
|
|
|
assert.Equals(t, "noop", p.GetName())
|
|
|
|
assert.Equals(t, noopType, p.GetType())
|
|
|
|
assert.Equals(t, nil, p.Init(Config{}))
|
2020-01-24 06:04:34 +00:00
|
|
|
assert.Equals(t, nil, p.AuthorizeRenew(context.Background(), &x509.Certificate{}))
|
|
|
|
assert.Equals(t, nil, p.AuthorizeRevoke(context.Background(), "foo"))
|
2019-03-11 19:56:47 +00:00
|
|
|
|
|
|
|
kid, key, ok := p.GetEncryptedKey()
|
|
|
|
assert.Equals(t, "", kid)
|
|
|
|
assert.Equals(t, "", key)
|
|
|
|
assert.Equals(t, false, ok)
|
|
|
|
|
2019-07-30 01:24:34 +00:00
|
|
|
ctx := NewContextWithMethod(context.Background(), SignMethod)
|
|
|
|
sigOptions, err := p.AuthorizeSign(ctx, "foo")
|
2022-03-28 22:06:56 +00:00
|
|
|
assert.Equals(t, []SignOption{&p}, sigOptions)
|
2019-03-11 19:56:47 +00:00
|
|
|
assert.Equals(t, nil, err)
|
|
|
|
}
|