MCPcopy
hub / github.com/git-lfs/git-lfs / TestCertFromSSLCAInfoEnv

Function TestCertFromSSLCAInfoEnv

lfshttp/certs_test.go:104–123  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

102}
103
104func TestCertFromSSLCAInfoEnv(t *testing.T) {
105 tempfile, err := os.CreateTemp("", "testcert")
106 assert.Nil(t, err, "Error creating temp cert file")
107 defer os.Remove(tempfile.Name())
108
109 _, err = tempfile.WriteString(testCert)
110 assert.Nil(t, err, "Error writing temp cert file")
111 tempfile.Close()
112
113 c, err := NewClient(NewContext(nil, map[string]string{
114 "GIT_SSL_CAINFO": tempfile.Name(),
115 }, nil))
116 assert.Nil(t, err)
117
118 // Should match any host at all
119 for _, matchedHostTest := range sslCAInfoMatchedHostTests {
120 pool := getRootCAsForHostFromGitconfig(c, matchedHostTest.hostName)
121 assert.NotNil(t, pool)
122 }
123}
124
125func TestCertFromSSLCAInfoEnvIsIgnoredForSchannelBackend(t *testing.T) {
126 tempfile, err := os.CreateTemp("", "testcert")

Callers

nothing calls this directly

Calls 6

NewContextFunction · 0.85
NewClientFunction · 0.70
NameMethod · 0.65
CloseMethod · 0.65
RemoveMethod · 0.45

Tested by

no test coverage detected