Overrides the http.Client with a fakeClient which sends a good response.
()
| 132 | |
| 133 | // Overrides the http.Client with a fakeClient which sends a good response. |
| 134 | func overrideHTTPClientGood() (*testutils.FakeHTTPClient, func()) { |
| 135 | fc := &testutils.FakeHTTPClient{ |
| 136 | ReqChan: testutils.NewChannel(), |
| 137 | RespChan: testutils.NewChannel(), |
| 138 | } |
| 139 | fc.RespChan.Send(makeGoodResponse()) |
| 140 | |
| 141 | origMakeHTTPDoer := makeHTTPDoer |
| 142 | makeHTTPDoer = func(_ *x509.CertPool) httpDoer { return fc } |
| 143 | return fc, func() { makeHTTPDoer = origMakeHTTPDoer } |
| 144 | } |
| 145 | |
| 146 | // Overrides the http.Client with the provided fakeClient. |
| 147 | func overrideHTTPClient(fc *testutils.FakeHTTPClient) func() { |
no test coverage detected