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

Function TestConsumeRuntimeCallAPI_TransportFailure

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

Source from the content-addressed store, hash-verified

106}
107
108func TestConsumeRuntimeCallAPI_TransportFailure(t *testing.T) {
109 r := newTestConsumeRuntime(stubRoundTripper{respond: func(*http.Request) (*http.Response, error) {
110 return nil, errors.New("connection refused")
111 }})
112 _, err := r.CallAPI(context.Background(), "GET", "/open-apis/event/v1/connection", nil)
113 if err == nil {
114 t.Fatal("expected error, got nil")
115 }
116 p, ok := errs.ProblemOf(err)
117 if !ok {
118 t.Fatalf("expected typed errs error, got %T: %v", err, err)
119 }
120 if p.Category != errs.CategoryNetwork {
121 t.Fatalf("category = %s, want %s", p.Category, errs.CategoryNetwork)
122 }
123}
124
125func TestConsumeRuntimeCallAPI_EnvelopeErrorIsTyped(t *testing.T) {
126 r := newTestConsumeRuntime(stubRoundTripper{respond: stubResponse(http.StatusOK, "application/json",

Callers

nothing calls this directly

Calls 3

ProblemOfFunction · 0.92
newTestConsumeRuntimeFunction · 0.85
CallAPIMethod · 0.65

Tested by

no test coverage detected