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

Function TestSSHCacheResolveWithoutError

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

Source from the content-addressed store, hash-verified

148}
149
150func TestSSHCacheResolveWithoutError(t *testing.T) {
151 ssh := newFakeResolver()
152 cache := withSSHCache(ssh).(*sshCache)
153
154 assert.Equal(t, 0, len(cache.endpoints))
155
156 ssh.responses["userandhost"] = sshAuthResponse{Href: "real"}
157
158 e := Endpoint{
159 SSHMetadata: sshp.SSHMetadata{
160 UserAndHost: "userandhost",
161 Port: "1",
162 Path: "path",
163 },
164 }
165
166 res, err := cache.Resolve(e, "post")
167 assert.Nil(t, err)
168 assert.Equal(t, "real", res.Href)
169
170 assert.Equal(t, 1, len(cache.endpoints))
171 cacheres, ok := cache.endpoints["userandhost//1//path//post"]
172 assert.True(t, ok)
173 assert.NotNil(t, cacheres)
174 assert.Equal(t, "real", cacheres.Href)
175
176 delete(ssh.responses, "userandhost")
177 res2, err := cache.Resolve(e, "post")
178 assert.Nil(t, err)
179 assert.Equal(t, "real", res2.Href)
180}
181
182func TestSSHCacheResolveWithError(t *testing.T) {
183 ssh := newFakeResolver()

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