MCPcopy Index your code
hub / github.com/coder/coder / Test_validateProxyURL

Function Test_validateProxyURL

enterprise/coderd/workspaceproxy_internal_test.go:9–61  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func Test_validateProxyURL(t *testing.T) {
10 t.Parallel()
11
12 testcases := []struct {
13 Name string
14 URL string
15 ExpectedError bool
16 }{
17 {
18 Name: "Empty",
19 URL: "",
20 ExpectedError: true,
21 },
22 {
23 Name: "EmptyWild",
24 URL: "",
25 ExpectedError: true,
26 },
27 {
28 Name: "URL",
29 URL: "https://example.com",
30 ExpectedError: false,
31 },
32 {
33 Name: "NoScheme",
34 URL: "example.com",
35 ExpectedError: true,
36 },
37 {
38 Name: "BadScheme",
39 URL: "ssh://example.com",
40 ExpectedError: true,
41 },
42 {
43 Name: "IncludePaths",
44 URL: "https://example.com/test",
45 ExpectedError: true,
46 },
47 }
48
49 for _, tt := range testcases {
50 t.Run(tt.Name, func(t *testing.T) {
51 t.Parallel()
52
53 err := validateProxyURL(tt.URL)
54 if tt.ExpectedError {
55 require.Error(t, err)
56 } else {
57 require.NoError(t, err)
58 }
59 })
60 }
61}

Callers

nothing calls this directly

Calls 3

validateProxyURLFunction · 0.85
RunMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected