MCPcopy Create free account
hub / github.com/belak/gitdir / TestCtxUser

Function TestCtxUser

context_test.go:105–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

103}
104
105func TestCtxUser(t *testing.T) {
106 t.Parallel()
107
108 ctx := context.Background()
109
110 // Check the default value
111 assert.Equal(t, AnonymousUser, CtxUser(ctx))
112
113 // Check that when we set a value, this properly extracts it.
114 user := &User{
115 Username: "belak",
116 IsAdmin: true,
117 }
118 ctx = context.WithValue(ctx, contextKeyUser, user)
119 assert.Equal(t, user, CtxUser(ctx))
120}
121
122func TestCtxSetLogger(t *testing.T) {
123 t.Skip("not implemented")

Callers

nothing calls this directly

Calls 1

CtxUserFunction · 0.85

Tested by

no test coverage detected