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

Function TestHttpBody

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

Source from the content-addressed store, hash-verified

182}
183
184func TestHttpBody(t *testing.T) {
185 assert := New(t)
186 mockT := new(mockTestingT)
187
188 assert.True(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!"))
189 assert.True(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World"))
190 assert.False(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world"))
191
192 assert.False(HTTPBodyNotContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!"))
193 assert.False(HTTPBodyNotContains(
194 mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World",
195 "Expected the request body to not contain 'World'. But it did.",
196 ))
197 assert.True(HTTPBodyNotContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world"))
198 assert.Contains(mockT.errorString(), "Expected the request body to not contain 'World'. But it did.")
199
200 assert.True(HTTPBodyContains(mockT, httpReadBody, "GET", "/", nil, "hello"))
201}
202
203func TestHttpBodyWrappers(t *testing.T) {
204 assert := New(t)

Callers

nothing calls this directly

Calls 7

errorStringMethod · 0.80
NewFunction · 0.70
HTTPBodyContainsFunction · 0.70
HTTPBodyNotContainsFunction · 0.70
TrueMethod · 0.45
FalseMethod · 0.45
ContainsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…