(t *testing.T)
| 53 | } |
| 54 | |
| 55 | func TestCopilot_InjectAuthHeader(t *testing.T) { |
| 56 | t.Parallel() |
| 57 | |
| 58 | // Copilot uses per-user key passed in the Authorization header, |
| 59 | // so InjectAuthHeader should not modify any headers. |
| 60 | provider := NewCopilot(config.Copilot{}) |
| 61 | |
| 62 | t.Run("ExistingHeaders_Unchanged", func(t *testing.T) { |
| 63 | t.Parallel() |
| 64 | |
| 65 | headers := http.Header{} |
| 66 | headers.Set("Authorization", "Bearer user-token") |
| 67 | headers.Set("X-Custom-Header", "custom-value") |
| 68 | |
| 69 | provider.InjectAuthHeader(&headers) |
| 70 | |
| 71 | assert.Equal(t, "Bearer user-token", headers.Get("Authorization"), |
| 72 | "Authorization header should remain unchanged") |
| 73 | assert.Equal(t, "custom-value", headers.Get("X-Custom-Header"), |
| 74 | "other headers should remain unchanged") |
| 75 | }) |
| 76 | |
| 77 | t.Run("EmptyHeaders_NoneAdded", func(t *testing.T) { |
| 78 | t.Parallel() |
| 79 | |
| 80 | headers := http.Header{} |
| 81 | |
| 82 | provider.InjectAuthHeader(&headers) |
| 83 | |
| 84 | assert.Empty(t, headers, "no headers should be added") |
| 85 | }) |
| 86 | } |
| 87 | |
| 88 | func TestCopilot_CreateInterceptor(t *testing.T) { |
| 89 | t.Parallel() |
nothing calls this directly
no test coverage detected