MCPcopy
hub / github.com/perkeep/perkeep / TestLocalhostAuthIPv4

Function TestLocalhostAuthIPv4

internal/httputil/auth_test.go:98–113  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestLocalhostAuthIPv4(t *testing.T) {
99 l, err := net.Listen("tcp", "127.0.0.1:0")
100 if err != nil {
101 t.Skip("skipping IPv4 test; can't listen on 127.0.0.1:0")
102 }
103 _, port, err := net.SplitHostPort(l.Addr().String())
104 if err != nil {
105 t.Fatal(err)
106 }
107
108 ts := testServer(t, l)
109 defer ts.Close()
110
111 testLoginRequest(t, &http.Client{}, "http://127.0.0.1:"+port)
112 testLoginRequest(t, &http.Client{}, "http://localhost:"+port)
113}
114
115func testLoginRequest(t *testing.T, client *http.Client, URL string) {
116 res, err := client.Get(URL)

Callers

nothing calls this directly

Calls 7

testServerFunction · 0.85
testLoginRequestFunction · 0.85
AddrMethod · 0.80
FatalMethod · 0.80
CloseMethod · 0.65
ListenMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected