MCPcopy
hub / github.com/moby/moby / TestPluginPush

Function TestPluginPush

client/plugin_push_test.go:30–47  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28}
29
30func TestPluginPush(t *testing.T) {
31 const expectedURL = "/plugins/plugin_name"
32
33 client, err := New(WithMockClient(func(req *http.Request) (*http.Response, error) {
34 if err := assertRequest(req, http.MethodPost, expectedURL); err != nil {
35 return nil, err
36 }
37 auth := req.Header.Get(registry.AuthHeader)
38 if auth != "authtoken" {
39 return nil, fmt.Errorf("invalid auth header: expected 'authtoken', got %s", auth)
40 }
41 return mockResponse(http.StatusOK, nil, "")(req)
42 }))
43 assert.NilError(t, err)
44
45 _, err = client.PluginPush(t.Context(), "plugin_name", PluginPushOptions{RegistryAuth: "authtoken"})
46 assert.NilError(t, err)
47}

Callers

nothing calls this directly

Calls 8

WithMockClientFunction · 0.85
assertRequestFunction · 0.85
mockResponseFunction · 0.85
ErrorfMethod · 0.80
NewFunction · 0.70
GetMethod · 0.65
PluginPushMethod · 0.65
ContextMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…