(t *testing.T)
| 107 | } |
| 108 | |
| 109 | func 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 | |
| 157 | func Test_SetMode_ErrorsWhen_HoverflyNotAccessible(t *testing.T) { |
| 158 | RegisterTestingT(t) |
nothing calls this directly
no test coverage detected