32 lines
581 B
Go
32 lines
581 B
Go
|
// Copyright 2024 Matthew Rich <matthewrich.conf@gmail.com>. All rights reserved.
|
||
|
|
||
|
package config
|
||
|
|
||
|
import (
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
"testing"
|
||
|
"crypto/x509"
|
||
|
)
|
||
|
|
||
|
func TestNewOpenPGPConfig(t *testing.T) {
|
||
|
p := NewOpenPGP()
|
||
|
assert.NotNil(t, p)
|
||
|
}
|
||
|
|
||
|
func TestNewOpenPGPConfigYAML(t *testing.T) {
|
||
|
p := NewOpenPGP()
|
||
|
assert.NotNil(t, p)
|
||
|
|
||
|
config := `
|
||
|
openpgp:
|
||
|
publickey:
|
||
|
|
||
|
`
|
||
|
|
||
|
yamlErr := c.LoadYAML(config)
|
||
|
assert.Nil(t, yamlErr)
|
||
|
crt, err := c.GetValue("catemplate")
|
||
|
assert.Nil(t, err)
|
||
|
assert.Equal(t, []string{"RKH"}, crt.(*x509.Certificate).Subject.Organization)
|
||
|
}
|