jx/internal/config/openpgp_test.go
Matthew Rich 35899c86a5
Some checks failed
Lint / golangci-lint (push) Failing after 9m51s
Declarative Tests / test (push) Failing after 14s
add openpgp resources
2024-11-10 10:27:31 -08:00

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)
}