MCPcopy Create free account
hub / github.com/docker/cli / TestTrustRevokeCommandErrors

Function TestTrustRevokeCommandErrors

cmd/docker-trust/trust/revoke_test.go:16–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

14)
15
16func TestTrustRevokeCommandErrors(t *testing.T) {
17 testCases := []struct {
18 name string
19 args []string
20 expectedError string
21 }{
22 {
23 name: "not-enough-args",
24 expectedError: "requires 1 argument",
25 },
26 {
27 name: "too-many-args",
28 args: []string{"remote1", "remote2"},
29 expectedError: "requires 1 argument",
30 },
31 {
32 name: "sha-reference",
33 args: []string{"870d292919d01a0af7e7f056271dc78792c05f55f49b9b9012b6d89725bd9abd"},
34 expectedError: "invalid repository name",
35 },
36 {
37 name: "invalid-img-reference",
38 args: []string{"ALPINE"},
39 expectedError: "invalid reference format",
40 },
41 {
42 name: "digest-reference",
43 args: []string{"ubuntu@sha256:45b23dee08af5e43a7fea6c4cf9c25ccf269ee113168c19722f87876677c5cb2"},
44 expectedError: "cannot use a digest reference for IMAGE:TAG",
45 },
46 }
47 for _, tc := range testCases {
48 cmd := newRevokeCommand(
49 test.NewFakeCli(&fakeClient{}))
50 cmd.SetArgs(tc.args)
51 cmd.SetOut(io.Discard)
52 cmd.SetErr(io.Discard)
53 assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
54 }
55}
56
57func TestTrustRevokeCommand(t *testing.T) {
58 revokeCancelledError := "trust revoke has been cancelled"

Callers

nothing calls this directly

Calls 4

newRevokeCommandFunction · 0.85
SetArgsMethod · 0.80
SetOutMethod · 0.45
SetErrMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…