Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions internal/git/command_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package git

import (
"net/http"
"net/http/httptest"
"os/exec"
"strings"
"testing"
Expand All @@ -16,11 +18,17 @@ func TestFetchFailureReason_TerminalPromptsDisabled(t *testing.T) {
}
}

func TestNetworkFetch_UnauthenticatedHTTPSFailsWithoutPrompt(t *testing.T) {
func TestNetworkFetch_UnauthenticatedHTTPFailsWithoutPrompt(t *testing.T) {
authServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("WWW-Authenticate", `Basic realm="git-rain-test"`)
http.Error(w, "authentication required", http.StatusUnauthorized)
}))
defer authServer.Close()

repo := testutil.CreateTestRepo(t, testutil.RepoOptions{
Name: "https-fetch-repo",
Remotes: map[string]string{
"origin": "https://github.com/git-rain/nonexistent-repo-auth-test.git",
"origin": authServer.URL + "/private-repo.git",
},
})

Expand Down
Loading