(t *testing.T)
| 234 | } |
| 235 | |
| 236 | func 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 | |
| 261 | func newChannelPipe(t *testing.T, w io.Writer, wg *sync.WaitGroup) (*os.File, error) { |
| 262 | pr, pw, err := os.Pipe() |
nothing calls this directly
no test coverage detected
searching dependent graphs…