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

Function TestParseUUID_Valid

coderd/httpmw/httpmw_internal_test.go:22–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

20)
21
22func TestParseUUID_Valid(t *testing.T) {
23 t.Parallel()
24
25 rw := httptest.NewRecorder()
26 r := httptest.NewRequest("GET", "/{workspaceagent}", nil)
27
28 ctx := chi.NewRouteContext()
29 ctx.URLParams.Add(testParam, testWorkspaceAgentID)
30 r = r.WithContext(context.WithValue(r.Context(), chi.RouteCtxKey, ctx))
31
32 parsed, ok := ParseUUIDParam(rw, r, "workspaceagent")
33 assert.True(t, ok, "UUID should be parsed")
34 assert.Equal(t, testWorkspaceAgentID, parsed.String())
35}
36
37func TestParseUUID_Invalid(t *testing.T) {
38 t.Parallel()

Callers

nothing calls this directly

Calls 6

ParseUUIDParamFunction · 0.85
WithContextMethod · 0.80
AddMethod · 0.65
ContextMethod · 0.65
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected