(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestTokenAuthInterceptor_NoTokenConfigured(t *testing.T) { |
| 15 | logger := zap.NewNop() |
| 16 | auth := NewTokenAuthInterceptor("", logger) |
| 17 | |
| 18 | // With no token configured, all requests should pass and inject default admin user |
| 19 | ctx := context.Background() |
| 20 | newCtx, err := auth.authorize(ctx, "/chatcli.v1.ChatCLIService/SendPrompt") |
| 21 | assert.NoError(t, err) |
| 22 | user := UserFromContext(newCtx) |
| 23 | assert.NotNil(t, user) |
| 24 | assert.Equal(t, RoleAdmin, user.Role) |
| 25 | } |
| 26 | |
| 27 | func TestTokenAuthInterceptor_HealthAlwaysAllowed(t *testing.T) { |
| 28 | logger := zap.NewNop() |
nothing calls this directly
no test coverage detected