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

Function TestScimError

enterprise/coderd/scim_test.go:867–883  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

865}
866
867func TestScimError(t *testing.T) {
868 t.Parallel()
869
870 // Demonstrates that we cannot use the standard errors
871 rw := httptest.NewRecorder()
872 _ = handlerutil.WriteError(rw, spec.ErrNotFound)
873 resp := rw.Result()
874 defer resp.Body.Close()
875 require.Equal(t, http.StatusInternalServerError, resp.StatusCode)
876
877 // Our error wrapper works
878 rw = httptest.NewRecorder()
879 _ = handlerutil.WriteError(rw, scim.NewHTTPError(http.StatusNotFound, spec.ErrNotFound.Type, xerrors.New("not found")))
880 resp = rw.Result()
881 defer resp.Body.Close()
882 require.Equal(t, http.StatusNotFound, resp.StatusCode)
883}

Callers

nothing calls this directly

Calls 5

NewHTTPErrorFunction · 0.92
CloseMethod · 0.65
NewMethod · 0.65
ResultMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected