MCPcopy Create free account
hub / github.com/coder/coder / TestParse

Function TestParse

cli/gitauth/askpass_test.go:25–71  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestParse(t *testing.T) {
26 t.Parallel()
27 for _, tc := range []struct {
28 in string
29 wantUser string
30 wantHost string
31 }{
32 {
33 in: "Username for 'https://github.com': ",
34 wantUser: "",
35 wantHost: "https://github.com",
36 },
37 {
38 in: "Username for 'https://enterprise.github.com': ",
39 wantUser: "",
40 wantHost: "https://enterprise.github.com",
41 },
42 {
43 in: "Username for 'http://wow.io': ",
44 wantUser: "",
45 wantHost: "http://wow.io",
46 },
47 {
48 in: "Password for 'https://myuser@github.com': ",
49 wantUser: "myuser",
50 wantHost: "https://github.com",
51 },
52 {
53 in: "Password for 'https://myuser@enterprise.github.com': ",
54 wantUser: "myuser",
55 wantHost: "https://enterprise.github.com",
56 },
57 {
58 in: "Password for 'http://myuser@wow.io': ",
59 wantUser: "myuser",
60 wantHost: "http://wow.io",
61 },
62 } {
63 t.Run(tc.in, func(t *testing.T) {
64 t.Parallel()
65 user, host, err := gitauth.ParseAskpass(tc.in)
66 require.NoError(t, err)
67 require.Equal(t, tc.wantUser, user)
68 require.Equal(t, tc.wantHost, host)
69 })
70 }
71}

Callers

nothing calls this directly

Calls 3

ParseAskpassFunction · 0.92
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected