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

Function TestSSHCacheResolveWithError

lfshttp/ssh_test.go:182–207  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

180}
181
182func TestSSHCacheResolveWithError(t *testing.T) {
183 ssh := newFakeResolver()
184 cache := withSSHCache(ssh).(*sshCache)
185
186 assert.Equal(t, 0, len(cache.endpoints))
187
188 ssh.responses["userandhost"] = sshAuthResponse{Message: "resolve error", Href: "real"}
189
190 e := Endpoint{
191 SSHMetadata: sshp.SSHMetadata{
192 UserAndHost: "userandhost",
193 Port: "1",
194 Path: "path",
195 },
196 }
197
198 res, err := cache.Resolve(e, "post")
199 assert.NotNil(t, err)
200 assert.Equal(t, "real", res.Href)
201
202 assert.Equal(t, 0, len(cache.endpoints))
203 delete(ssh.responses, "userandhost")
204 res2, err := cache.Resolve(e, "post")
205 assert.Nil(t, err)
206 assert.Equal(t, "", res2.Href)
207}
208
209func newFakeResolver() *fakeResolver {
210 return &fakeResolver{responses: make(map[string]sshAuthResponse)}

Callers

nothing calls this directly

Calls 4

newFakeResolverFunction · 0.85
withSSHCacheFunction · 0.85
ResolveMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected