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

Function Test_RequestValidate

coderd/workspaceapps/request_test.go:12–290  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func Test_RequestValidate(t *testing.T) {
13 t.Parallel()
14
15 cases := []struct {
16 name string
17 req workspaceapps.Request
18 noNormalize bool
19 errContains string
20 }{
21 {
22 name: "OK1",
23 req: workspaceapps.Request{
24 AccessMethod: workspaceapps.AccessMethodPath,
25 BasePath: "/",
26 UsernameOrID: "foo",
27 WorkspaceNameOrID: "bar",
28 AgentNameOrID: "baz",
29 AppSlugOrPort: "qux",
30 },
31 },
32 {
33 name: "OK2",
34 req: workspaceapps.Request{
35 AccessMethod: workspaceapps.AccessMethodSubdomain,
36 BasePath: "/",
37 UsernameOrID: "foo",
38 WorkspaceAndAgent: "bar.baz",
39 AppSlugOrPort: "qux",
40 },
41 },
42 {
43 name: "OK3",
44 req: workspaceapps.Request{
45 AccessMethod: workspaceapps.AccessMethodTerminal,
46 BasePath: "/",
47 AgentNameOrID: uuid.New().String(),
48 },
49 },
50 {
51 name: "OK4",
52 req: workspaceapps.Request{
53 AccessMethod: workspaceapps.AccessMethodPath,
54 BasePath: "/",
55 UsernameOrID: "foo",
56 WorkspaceNameOrID: "bar",
57 AppSlugOrPort: "baz",
58 },
59 },
60 {
61 name: "OK5",
62 req: workspaceapps.Request{
63 AccessMethod: workspaceapps.AccessMethodSubdomain,
64 BasePath: "/",
65 UsernameOrID: "foo",
66 WorkspaceNameOrID: "bar",
67 AppSlugOrPort: "8080",
68 },
69 },

Callers

nothing calls this directly

Calls 6

NormalizeMethod · 0.80
NewMethod · 0.65
RunMethod · 0.65
CheckMethod · 0.65
StringMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected