MCPcopy
hub / github.com/expr-lang/expr / TestHTTPError

Function TestHTTPError

internal/testify/assert/http_assertions_test.go:85–107  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestHTTPError(t *testing.T) {
86 assert := New(t)
87
88 mockT1 := new(testing.T)
89 assert.Equal(HTTPError(mockT1, httpOK, "GET", "/", nil), false)
90 assert.True(mockT1.Failed())
91
92 mockT2 := new(mockTestingT)
93 assert.Equal(HTTPError(
94 mockT2, httpRedirect, "GET", "/", nil,
95 "Expected this request to error out. But it didn't",
96 ), false)
97 assert.True(mockT2.Failed())
98 assert.Contains(mockT2.errorString(), "Expected this request to error out. But it didn't")
99
100 mockT3 := new(testing.T)
101 assert.Equal(HTTPError(mockT3, httpError, "GET", "/", nil), true)
102 assert.False(mockT3.Failed())
103
104 mockT4 := new(testing.T)
105 assert.Equal(HTTPError(mockT4, httpStatusCode, "GET", "/", nil), false)
106 assert.True(mockT4.Failed())
107}
108
109func TestHTTPStatusCode(t *testing.T) {
110 assert := New(t)

Callers

nothing calls this directly

Calls 8

FailedMethod · 0.80
errorStringMethod · 0.80
NewFunction · 0.70
HTTPErrorFunction · 0.70
EqualMethod · 0.65
TrueMethod · 0.45
ContainsMethod · 0.45
FalseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…