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 {
|
func (p *Provisioner) Init(global *ProvisionerClaims) error {
|
||||||
switch {
|
switch {
|
||||||
case p.Name == "":
|
case p.Name == "":
|
||||||
return errors.New("provisioner issuer cannot be empty")
|
return errors.New("provisioner name cannot be empty")
|
||||||
|
|
||||||
case p.Type == "":
|
case p.Type == "":
|
||||||
return errors.New("provisioner type cannot be empty")
|
return errors.New("provisioner type cannot be empty")
|
||||||
|
|
|
@ -14,10 +14,10 @@ func TestProvisionerInit(t *testing.T) {
|
||||||
err error
|
err error
|
||||||
}
|
}
|
||||||
tests := map[string]func(*testing.T) ProvisionerValidateTest{
|
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{
|
return ProvisionerValidateTest{
|
||||||
p: &Provisioner{},
|
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 {
|
"fail-empty-type": func(t *testing.T) ProvisionerValidateTest {
|
||||||
|
|
|
@ -128,7 +128,7 @@ func TestGetProvisioners(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func generateProvisioner(t *testing.T) *Provisioner {
|
func generateProvisioner(t *testing.T) *Provisioner {
|
||||||
issuer, err := randutil.Alphanumeric(10)
|
name, err := randutil.Alphanumeric(10)
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
// Create a new JWK
|
// Create a new JWK
|
||||||
jwk, err := jose.GenerateJWK("EC", "P-256", "ES256", "sig", "", 0)
|
jwk, err := jose.GenerateJWK("EC", "P-256", "ES256", "sig", "", 0)
|
||||||
|
@ -155,7 +155,7 @@ func generateProvisioner(t *testing.T) *Provisioner {
|
||||||
encrypted, err := jwe.CompactSerialize()
|
encrypted, err := jwe.CompactSerialize()
|
||||||
assert.FatalError(t, err)
|
assert.FatalError(t, err)
|
||||||
return &Provisioner{
|
return &Provisioner{
|
||||||
Name: issuer,
|
Name: name,
|
||||||
Type: "JWT",
|
Type: "JWT",
|
||||||
Key: &public,
|
Key: &public,
|
||||||
EncryptedKey: encrypted,
|
EncryptedKey: encrypted,
|
||||||
|
|
Loading…
Reference in a new issue