(t *testing.T)
| 103 | } |
| 104 | |
| 105 | func 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 | |
| 122 | func TestCtxSetLogger(t *testing.T) { |
| 123 | t.Skip("not implemented") |