MCPcopy
hub / github.com/mislav/hub / TestClient_FormatError

Function TestClient_FormatError

github/client_test.go:12–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestClient_FormatError(t *testing.T) {
13 e := &errorInfo{
14 Response: &http.Response{
15 StatusCode: 401,
16 Status: "401 Not Found",
17 },
18 }
19
20 err := FormatError("action", e)
21 assert.Equal(t, "Error action: Not Found (HTTP 401)", fmt.Sprintf("%s", err))
22
23 e = &errorInfo{
24 Response: &http.Response{
25 StatusCode: 422,
26 Status: "422 Unprocessable Entity",
27 },
28 Message: "error message",
29 }
30 err = FormatError("action", e)
31 assert.Equal(t, "Error action: Unprocessable Entity (HTTP 422)\nerror message", fmt.Sprintf("%s", err))
32}
33
34func TestAuthTokenNote(t *testing.T) {
35 note, err := authTokenNote(1)

Callers

nothing calls this directly

Calls 1

FormatErrorFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…