MCPcopy Create free account
hub / github.com/containers/image / testTokenHTTPResponse

Function testTokenHTTPResponse

docker/docker_client_test.go:97–107  ·  view source on GitHub ↗

testTokenHTTPResponse creates just enough of a *http.Response to work with newBearerTokenFromHTTPResponseBody.

(t *testing.T, body string)

Source from the content-addressed store, hash-verified

95
96// testTokenHTTPResponse creates just enough of a *http.Response to work with newBearerTokenFromHTTPResponseBody.
97func 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
109func TestNewBearerTokenFromHTTPResponseBody(t *testing.T) {
110 for _, c := range []struct {

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…