1
1
package util
2
2
3
3
import (
4
- "testing"
5
- "os"
4
+ "encoding/hex"
6
5
"io/ioutil"
6
+ "os"
7
7
"reflect"
8
- "encoding/hex "
8
+ "testing "
9
9
10
10
"github.com/bmizerany/assert"
11
11
)
12
12
13
13
var (
14
14
testCA1Subj = "301e311c301a060355040313136f617574682d70726f78792074657374206361"
15
- testCA1 = `-----BEGIN CERTIFICATE-----
15
+ testCA1 = `-----BEGIN CERTIFICATE-----
16
16
MIICuTCCAaGgAwIBAgIFAKuKEWowDQYJKoZIhvcNAQELBQAwHjEcMBoGA1UEAxMT
17
17
b2F1dGgtcHJveHkgdGVzdCBjYTAeFw0xNzEwMjQyMDExMzJaFw0xOTEwMjQyMDEx
18
18
MzJaMB4xHDAaBgNVBAMTE29hdXRoLXByb3h5IHRlc3QgY2EwggEiMA0GCSqGSIb3
@@ -31,7 +31,7 @@ pP5YlVqdRCVrxgT80PIMsvQhfcuIrbbeiRDEUdEX7FqebuGCEa2757MTdW7UYQiB
31
31
-----END CERTIFICATE-----
32
32
`
33
33
testCA2Subj = "3025312330210603550403131a6f617574682d70726f7879207365636f6e642074657374206361"
34
- testCA2 = `-----BEGIN CERTIFICATE-----
34
+ testCA2 = `-----BEGIN CERTIFICATE-----
35
35
MIICxzCCAa+gAwIBAgIFAKuMKewwDQYJKoZIhvcNAQELBQAwJTEjMCEGA1UEAxMa
36
36
b2F1dGgtcHJveHkgc2Vjb25kIHRlc3QgY2EwHhcNMTcxMDI1MTYxMTQxWhcNMTkx
37
37
MDI1MTYxMTQxWjAlMSMwIQYDVQQDExpvYXV0aC1wcm94eSBzZWNvbmQgdGVzdCBj
@@ -64,18 +64,18 @@ func makeTestCertFile(t *testing.T, pem, dir string) *os.File {
64
64
}
65
65
66
66
func TestGetCertPool (t * testing.T ) {
67
- _ , err := GetCertPool ([]string (nil ))
67
+ _ , err := GetCertPool ([]string (nil ), false )
68
68
if err == nil {
69
69
t .Errorf ("expected an error" )
70
70
}
71
- assert .Equal (t , "Invalid empty list of Root CAs file paths" , err .Error ())
71
+ assert .Equal (t , "Invalid empty list of Root CAs file paths" , err .Error ())
72
72
73
73
tempDir := os .TempDir ()
74
74
defer os .RemoveAll (tempDir )
75
75
certFile1 := makeTestCertFile (t , testCA1 , tempDir )
76
76
certFile2 := makeTestCertFile (t , testCA2 , tempDir )
77
77
78
- certPool , err := GetCertPool ([]string {certFile1 .Name (), certFile2 .Name ()})
78
+ certPool , err := GetCertPool ([]string {certFile1 .Name (), certFile2 .Name ()}, false )
79
79
if err != nil {
80
80
t .Errorf ("unexpected error %v" , err )
81
81
}
0 commit comments