forked from TrueCloudLab/certificates
Use name instead of issuer in error message.
This commit is contained in:
parent
0d9dd2d14b
commit
428661f472
3 changed files with 5 additions and 5 deletions
|
@ -96,7 +96,7 @@ type Provisioner struct {
|
|||
func (p *Provisioner) Init(global *ProvisionerClaims) error {
|
||||
switch {
|
||||
case p.Name == "":
|
||||
return errors.New("provisioner issuer cannot be empty")
|
||||
return errors.New("provisioner name cannot be empty")
|
||||
|
||||
case p.Type == "":
|
||||
return errors.New("provisioner type cannot be empty")
|
||||
|
|
|
@ -14,10 +14,10 @@ func TestProvisionerInit(t *testing.T) {
|
|||
err error
|
||||
}
|
||||
tests := map[string]func(*testing.T) ProvisionerValidateTest{
|
||||
"fail-empty-issuer": func(t *testing.T) ProvisionerValidateTest {
|
||||
"fail-empty-name": func(t *testing.T) ProvisionerValidateTest {
|
||||
return ProvisionerValidateTest{
|
||||
p: &Provisioner{},
|
||||
err: errors.New("provisioner issuer cannot be empty"),
|
||||
err: errors.New("provisioner name cannot be empty"),
|
||||
}
|
||||
},
|
||||
"fail-empty-type": func(t *testing.T) ProvisionerValidateTest {
|
||||
|
|
|
@ -128,7 +128,7 @@ func TestGetProvisioners(t *testing.T) {
|
|||
}
|
||||
|
||||
func generateProvisioner(t *testing.T) *Provisioner {
|
||||
issuer, err := randutil.Alphanumeric(10)
|
||||
name, err := randutil.Alphanumeric(10)
|
||||
assert.FatalError(t, err)
|
||||
// Create a new JWK
|
||||
jwk, err := jose.GenerateJWK("EC", "P-256", "ES256", "sig", "", 0)
|
||||
|
@ -155,7 +155,7 @@ func generateProvisioner(t *testing.T) *Provisioner {
|
|||
encrypted, err := jwe.CompactSerialize()
|
||||
assert.FatalError(t, err)
|
||||
return &Provisioner{
|
||||
Name: issuer,
|
||||
Name: name,
|
||||
Type: "JWT",
|
||||
Key: &public,
|
||||
EncryptedKey: encrypted,
|
||||
|
|
Loading…
Reference in a new issue