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

Function TestHTTPStatusCode

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

Source from the content-addressed store, hash-verified

107}
108
109func TestHTTPStatusCode(t *testing.T) {
110 assert := New(t)
111
112 mockT1 := new(testing.T)
113 assert.Equal(HTTPStatusCode(mockT1, httpOK, "GET", "/", nil, http.StatusSwitchingProtocols), false)
114 assert.True(mockT1.Failed())
115
116 mockT2 := new(testing.T)
117 assert.Equal(HTTPStatusCode(mockT2, httpRedirect, "GET", "/", nil, http.StatusSwitchingProtocols), false)
118 assert.True(mockT2.Failed())
119
120 mockT3 := new(mockTestingT)
121 assert.Equal(HTTPStatusCode(
122 mockT3, httpError, "GET", "/", nil, http.StatusSwitchingProtocols,
123 "Expected the status code to be %d", http.StatusSwitchingProtocols,
124 ), false)
125 assert.True(mockT3.Failed())
126 assert.Contains(mockT3.errorString(), "Expected the status code to be 101")
127
128 mockT4 := new(testing.T)
129 assert.Equal(HTTPStatusCode(mockT4, httpStatusCode, "GET", "/", nil, http.StatusSwitchingProtocols), true)
130 assert.False(mockT4.Failed())
131}
132
133func TestHTTPStatusesWrapper(t *testing.T) {
134 assert := New(t)

Callers

nothing calls this directly

Calls 8

FailedMethod · 0.80
errorStringMethod · 0.80
NewFunction · 0.70
HTTPStatusCodeFunction · 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…