(t *testing.T)
| 35 | } |
| 36 | |
| 37 | func TestParseUUID_Invalid(t *testing.T) { |
| 38 | t.Parallel() |
| 39 | |
| 40 | rw := httptest.NewRecorder() |
| 41 | r := httptest.NewRequest("GET", "/{workspaceagent}", nil) |
| 42 | |
| 43 | ctx := chi.NewRouteContext() |
| 44 | ctx.URLParams.Add(testParam, "wrong-id") |
| 45 | r = r.WithContext(context.WithValue(r.Context(), chi.RouteCtxKey, ctx)) |
| 46 | |
| 47 | _, ok := ParseUUIDParam(rw, r, "workspaceagent") |
| 48 | assert.False(t, ok, "UUID should not be parsed") |
| 49 | assert.Equal(t, http.StatusBadRequest, rw.Code) |
| 50 | |
| 51 | var response codersdk.Response |
| 52 | err := json.Unmarshal(rw.Body.Bytes(), &response) |
| 53 | require.NoError(t, err) |
| 54 | assert.Contains(t, response.Message, `Invalid UUID "wrong-id"`) |
| 55 | } |
| 56 | |
| 57 | // TestNormalizeAudienceURI tests URI normalization for OAuth2 audience validation |
| 58 | func TestNormalizeAudienceURI(t *testing.T) { |
nothing calls this directly
no test coverage detected