MCPcopy Index your code
hub / github.com/docker/docker-agent / TestPrintAuthInfoText

Function TestPrintAuthInfoText

cmd/root/debug_auth_test.go:67–90  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

65}
66
67func TestPrintAuthInfoText(t *testing.T) {
68 t.Parallel()
69
70 info := &authInfo{
71 Token: "eyJhbGciOiJIUzI1NiJ9.xxxxxxxxxxxx.yyyyyyyy1234567890",
72 Username: "testuser",
73 Email: "test@example.com",
74 Subject: "sub-123",
75 Issuer: "docker",
76 IssuedAt: time.Date(2025, 1, 1, 0, 0, 0, 0, time.UTC),
77 ExpiresAt: time.Date(2099, 1, 1, 0, 0, 0, 0, time.UTC),
78 Expired: false,
79 }
80
81 var buf bytes.Buffer
82 printAuthInfoText(&buf, info)
83
84 output := buf.String()
85 assert.Contains(t, output, "testuser")
86 assert.Contains(t, output, "test@example.com")
87 assert.Contains(t, output, "sub-123")
88 assert.Contains(t, output, "docker")
89 assert.Contains(t, output, "✅ Valid")
90}
91
92func TestPrintAuthInfoText_Expired(t *testing.T) {
93 t.Parallel()

Callers

nothing calls this directly

Calls 2

StringMethod · 0.95
printAuthInfoTextFunction · 0.85

Tested by

no test coverage detected