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

Function TestHTTPSuccess

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

Source from the content-addressed store, hash-verified

31}
32
33func TestHTTPSuccess(t *testing.T) {
34 assert := New(t)
35
36 mockT1 := new(testing.T)
37 assert.Equal(HTTPSuccess(mockT1, httpOK, "GET", "/", nil), true)
38 assert.False(mockT1.Failed())
39
40 mockT2 := new(testing.T)
41 assert.Equal(HTTPSuccess(mockT2, httpRedirect, "GET", "/", nil), false)
42 assert.True(mockT2.Failed())
43
44 mockT3 := new(mockTestingT)
45 assert.Equal(HTTPSuccess(
46 mockT3, httpError, "GET", "/", nil,
47 "was not expecting a failure here",
48 ), false)
49 assert.True(mockT3.Failed())
50 assert.Contains(mockT3.errorString(), "was not expecting a failure here")
51
52 mockT4 := new(testing.T)
53 assert.Equal(HTTPSuccess(mockT4, httpStatusCode, "GET", "/", nil), false)
54 assert.True(mockT4.Failed())
55
56 mockT5 := new(testing.T)
57 assert.Equal(HTTPSuccess(mockT5, httpReadBody, "POST", "/", nil), true)
58 assert.False(mockT5.Failed())
59}
60
61func TestHTTPRedirect(t *testing.T) {
62 assert := New(t)

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…