MCPcopy Index your code
hub / github.com/SpectoLabs/hoverfly / Test_SetMode_SendsCorrectHTTPRequest

Function Test_SetMode_SendsCorrectHTTPRequest

hoverctl/wrapper/mode_test.go:109–155  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

107}
108
109func Test_SetMode_SendsCorrectHTTPRequest(t *testing.T) {
110 RegisterTestingT(t)
111
112 hoverfly.DeleteSimulation()
113 hoverfly.PutSimulation(v2.SimulationViewV5{
114 DataViewV5: v2.DataViewV5{
115 RequestResponsePairs: []v2.RequestMatcherResponsePairViewV5{
116 {
117 RequestMatcher: v2.RequestMatcherViewV5{
118 Method: []v2.MatcherViewV5{
119 {
120 Matcher: matchers.Exact,
121 Value: "PUT",
122 },
123 },
124 Path: []v2.MatcherViewV5{
125 {
126 Matcher: matchers.Exact,
127 Value: "/api/v2/hoverfly/mode",
128 },
129 },
130 Body: []v2.MatcherViewV5{
131 {
132 Matcher: matchers.Json,
133 Value: `{"mode":"capture","arguments":{}}`,
134 },
135 },
136 },
137 Response: v2.ResponseDetailsViewV5{
138 Status: 200,
139 Body: `{"mode": "capture"}`,
140 },
141 },
142 },
143 },
144 MetaView: v2.MetaView{
145 SchemaVersion: "v2",
146 },
147 })
148
149 mode, err := SetModeWithArguments(target, &v2.ModeView{
150 Mode: "capture",
151 })
152 Expect(err).To(BeNil())
153
154 Expect(mode).To(Equal("capture"))
155}
156
157func Test_SetMode_ErrorsWhen_HoverflyNotAccessible(t *testing.T) {
158 RegisterTestingT(t)

Callers

nothing calls this directly

Calls 3

SetModeWithArgumentsFunction · 0.85
DeleteSimulationMethod · 0.65
PutSimulationMethod · 0.65

Tested by

no test coverage detected