withFakeHTTP swaps httpGetForVersion for the duration of the test.
(t *testing.T, fn func(url string) (*http.Response, error))
| 22 | |
| 23 | // withFakeHTTP swaps httpGetForVersion for the duration of the test. |
| 24 | func withFakeHTTP(t *testing.T, fn func(url string) (*http.Response, error)) { |
| 25 | t.Helper() |
| 26 | old := httpGetForVersion |
| 27 | httpGetForVersion = fn |
| 28 | t.Cleanup(func() { httpGetForVersion = old }) |
| 29 | } |
| 30 | |
| 31 | // withFlowRoot points $FLOW_ROOT at a tempdir so version-cache writes |
| 32 | // don't touch the developer's real ~/.flow. |
no outgoing calls
no test coverage detected