MCPcopy Index your code
hub / github.com/gavv/httpexpect / TestExpect_Requests

Function TestExpect_Requests

expect_test.go:27–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

25}
26
27func TestExpect_Requests(t *testing.T) {
28 client := &mockClient{}
29
30 reporter := NewAssertReporter(t)
31
32 config := Config{
33 BaseURL: "http://example.com",
34 Client: client,
35 Reporter: reporter,
36 }
37
38 var reqs [8]*Request
39
40 e := WithConfig(config)
41
42 reqs[0] = e.Request("GET", "/url")
43 reqs[1] = e.OPTIONS("/url")
44 reqs[2] = e.HEAD("/url")
45 reqs[3] = e.GET("/url")
46 reqs[4] = e.POST("/url")
47 reqs[5] = e.PUT("/url")
48 reqs[6] = e.PATCH("/url")
49 reqs[7] = e.DELETE("/url")
50
51 assert.Equal(t, "GET", reqs[0].httpReq.Method)
52 assert.Equal(t, "OPTIONS", reqs[1].httpReq.Method)
53 assert.Equal(t, "HEAD", reqs[2].httpReq.Method)
54 assert.Equal(t, "GET", reqs[3].httpReq.Method)
55 assert.Equal(t, "POST", reqs[4].httpReq.Method)
56 assert.Equal(t, "PUT", reqs[5].httpReq.Method)
57 assert.Equal(t, "PATCH", reqs[6].httpReq.Method)
58 assert.Equal(t, "DELETE", reqs[7].httpReq.Method)
59}
60
61func TestExpect_Builders(t *testing.T) {
62 t.Run("basic", func(t *testing.T) {

Callers

nothing calls this directly

Calls 11

NewAssertReporterFunction · 0.85
WithConfigFunction · 0.85
OPTIONSMethod · 0.80
HEADMethod · 0.80
GETMethod · 0.80
POSTMethod · 0.80
PUTMethod · 0.80
PATCHMethod · 0.80
DELETEMethod · 0.80
RequestMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…