feat: test coverage more than 80%

This commit is contained in:
2023-03-05 00:04:41 +01:00
parent 72ffe8456d
commit 89136cae59
2 changed files with 15 additions and 18 deletions

View File

@@ -83,6 +83,12 @@ func Test_newRootCA(t *testing.T) {
require.Greater(t, len(keyPEM), 0)
}
func Test_newRootCAError(t *testing.T) {
_, _, err := newRootCA(&ca.CaConfig{})
require.Error(t, err)
}
func Test_parseCertificate(t *testing.T) {
caPEM, _, err := newRootCA(&rootTestConfig)
require.NoError(t, err)
@@ -126,3 +132,12 @@ func Test_rootCA_WithClientCert(t *testing.T) {
require.NotNil(t, clientSrv.PEM())
require.Greater(t, len(clientSrv.PEM()), 0)
}
func Test_rootCA_WithClientCertEror(t *testing.T) {
rootCert := rootCA{
caPEM: nil,
}
_, err := rootCert.WithClientCert(&clientTestConfig)
require.Error(t, err)
}