MCPcopy Create free account
hub / github.com/libgit2/git2go / TestRemoteCredentialsCalled

Function TestRemoteCredentialsCalled

remote_test.go:236–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

234}
235
236func TestRemoteCredentialsCalled(t *testing.T) {
237 t.Parallel()
238
239 repo := createTestRepo(t)
240 defer cleanupTestRepo(t, repo)
241
242 remote, err := repo.Remotes.CreateAnonymous("https://github.com/libgit2/non-existent")
243 checkFatal(t, err)
244 defer remote.Free()
245
246 errNonExistent := errors.New("non-existent repository")
247 fetchOpts := FetchOptions{
248 RemoteCallbacks: RemoteCallbacks{
249 CredentialsCallback: func(url, username string, allowedTypes CredentialType) (*Credential, error) {
250 return nil, errNonExistent
251 },
252 },
253 }
254
255 err = remote.Fetch(nil, &fetchOpts, "fetch")
256 if err != errNonExistent {
257 t.Fatalf("remote.Fetch() = %v, want %v", err, errNonExistent)
258 }
259}
260
261func newChannelPipe(t *testing.T, w io.Writer, wg *sync.WaitGroup) (*os.File, error) {
262 pr, pw, err := os.Pipe()

Callers

nothing calls this directly

Calls 6

createTestRepoFunction · 0.85
cleanupTestRepoFunction · 0.85
checkFatalFunction · 0.85
CreateAnonymousMethod · 0.80
FetchMethod · 0.80
FreeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…