MCPcopy
hub / github.com/hashicorp/go-getter / TestAddAuthFromNetrc

Function TestAddAuthFromNetrc

netrc_test.go:8–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestAddAuthFromNetrc(t *testing.T) {
9 defer tempEnv(t, "NETRC", "./testdata/netrc/basic")()
10
11 u, err := url.Parse("http://example.com")
12 if err != nil {
13 t.Fatalf("err: %s", err)
14 }
15
16 if err := addAuthFromNetrc(u); err != nil {
17 t.Fatalf("err: %s", err)
18 }
19
20 expected := "http://foo:bar@example.com"
21 actual := u.String()
22 if expected != actual {
23 t.Fatalf("Mismatch: %q != %q", actual, expected)
24 }
25}
26
27func TestAddAuthFromNetrc_hasAuth(t *testing.T) {
28 defer tempEnv(t, "NETRC", "./testdata/netrc/basic")()

Callers

nothing calls this directly

Calls 3

tempEnvFunction · 0.85
addAuthFromNetrcFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected