MCPcopy
hub / github.com/larksuite/cli / TestConsumeRuntimeCallAPI_NonJSONHTTPError

Function TestConsumeRuntimeCallAPI_NonJSONHTTPError

cmd/event/runtime_test.go:79–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

77}
78
79func TestConsumeRuntimeCallAPI_NonJSONHTTPError(t *testing.T) {
80 r := newTestConsumeRuntime(stubRoundTripper{respond: stubResponse(http.StatusNotFound, "text/plain", "gone")})
81 _, err := r.CallAPI(context.Background(), "GET", "/open-apis/event/v1/connection", nil)
82 requireCallAPIProblem(t, err, errs.CategoryInternal, errs.SubtypeInvalidResponse)
83 if !strings.Contains(err.Error(), "returned 404") {
84 t.Errorf("error should echo the HTTP status, got: %v", err)
85 }
86}
87
88func TestConsumeRuntimeCallAPI_NonJSONHTTPErrorTruncatesLongBody(t *testing.T) {
89 long := strings.Repeat("x", 300)

Callers

nothing calls this directly

Calls 6

newTestConsumeRuntimeFunction · 0.85
requireCallAPIProblemFunction · 0.85
stubResponseFunction · 0.70
CallAPIMethod · 0.65
ContainsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected