[WIP] Use a managed HTTP(S) transport implementation #374
|
@ -184,3 +184,26 @@ func TestRemotePrune(t *testing.T) {
|
|||
t.Fatal("Expected error getting a pruned reference")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemoteCredentialsCalled(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
repo := createTestRepo(t)
|
||||
defer cleanupTestRepo(t, repo)
|
||||
|
||||
remote, err := repo.Remotes.CreateAnonymous("https://github.com/libgit2/non-existent")
|
||||
checkFatal(t, err)
|
||||
|
||||
fetchOpts := FetchOptions{
|
||||
RemoteCallbacks: RemoteCallbacks{
|
||||
CredentialsCallback: func(url, username string, allowedTypes CredType) (ErrorCode, *Cred) {
|
||||
return ErrUser, nil
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
err = remote.Fetch(nil, &fetchOpts, "fetch")
|
||||
if !IsErrorCode(err, ErrUser) {
|
||||
t.Fatal("Bad Fetch return, expected ErrUser, got", err)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue