cacert-gosigner/x509/openssl/repository_test.go

32 lines
798 B
Go

package openssl_test
import (
"path"
"testing"
"git.cacert.org/cacert-gosigner/x509/openssl"
"git.cacert.org/cacert-gosigner/x509/revoking"
"git.cacert.org/cacert-gosigner/x509/signing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestStoreRevocation(t *testing.T) {
fr, err := openssl.NewFileRepository(t.TempDir())
require.NoError(t, err)
err = fr.StoreRevocation(&revoking.CertificateRevoked{})
assert.NoError(t, err)
assert.FileExists(t, path.Join(t.TempDir(), "index.txt"))
}
func TestStoreCertificate(t *testing.T) {
fr, err := openssl.NewFileRepository(t.TempDir())
require.NoError(t, err)
err = fr.StoreCertificate(&signing.CertificateSigned{})
assert.NoError(t, err)
assert.FileExists(t, path.Join(t.TempDir(), "index.txt"))
}