newTestClient stands up an httptest server with the supplied handler and returns an *sdk.Client targeting it plus a teardown closure. The real SDK is used so we exercise the same Raw() code path as production (header injection, JSON marshalling, etc.).
(t *testing.T, h http.HandlerFunc)
| 37 | // used so we exercise the same Raw() code path as production (header |
| 38 | // injection, JSON marshalling, etc.). |
| 39 | func newTestClient(t *testing.T, h http.HandlerFunc) (*sdk.Client, func()) { |
| 40 | t.Helper() |
| 41 | srv := httptest.NewServer(h) |
| 42 | return sdk.NewClient(srv.URL), srv.Close |
| 43 | } |
| 44 | |
| 45 | func TestAPI_GetSuccess(t *testing.T) { |
| 46 | out, _ := iostreams.SetForTest(t) |
no outgoing calls
no test coverage detected