testTokenHTTPResponse creates just enough of a *http.Response to work with newBearerTokenFromHTTPResponseBody.
(t *testing.T, body string)
| 95 | |
| 96 | // testTokenHTTPResponse creates just enough of a *http.Response to work with newBearerTokenFromHTTPResponseBody. |
| 97 | func testTokenHTTPResponse(t *testing.T, body string) *http.Response { |
| 98 | requestURL, err := url.Parse("https://example.com/token") |
| 99 | require.NoError(t, err) |
| 100 | return &http.Response{ |
| 101 | Body: io.NopCloser(bytes.NewReader([]byte(body))), |
| 102 | Request: &http.Request{ |
| 103 | Method: "", |
| 104 | URL: requestURL, |
| 105 | }, |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | func TestNewBearerTokenFromHTTPResponseBody(t *testing.T) { |
| 110 | for _, c := range []struct { |
no outgoing calls
no test coverage detected
searching dependent graphs…