e50cabac4b
- Updated all references from v6 to v7 for `github.com/router-for-me/CLIProxyAPI`. - Ensured consistency in imports within core libraries, tests, and integration tests. - Added missing tests for new features in Redis Protocol integration.
34 lines
1.0 KiB
Go
34 lines
1.0 KiB
Go
package claude
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/router-for-me/CLIProxyAPI/v7/internal/config"
|
|
"golang.org/x/net/proxy"
|
|
)
|
|
|
|
func TestNewClaudeAuthWithProxyURL_OverrideDirectTakesPrecedence(t *testing.T) {
|
|
cfg := &config.Config{SDKConfig: config.SDKConfig{ProxyURL: "socks5://proxy.example.com:1080"}}
|
|
auth := NewClaudeAuthWithProxyURL(cfg, "direct")
|
|
|
|
transport, ok := auth.httpClient.Transport.(*utlsRoundTripper)
|
|
if !ok || transport == nil {
|
|
t.Fatalf("expected utlsRoundTripper, got %T", auth.httpClient.Transport)
|
|
}
|
|
if transport.dialer != proxy.Direct {
|
|
t.Fatalf("expected proxy.Direct, got %T", transport.dialer)
|
|
}
|
|
}
|
|
|
|
func TestNewClaudeAuthWithProxyURL_OverrideProxyAppliedWithoutConfig(t *testing.T) {
|
|
auth := NewClaudeAuthWithProxyURL(nil, "socks5://proxy.example.com:1080")
|
|
|
|
transport, ok := auth.httpClient.Transport.(*utlsRoundTripper)
|
|
if !ok || transport == nil {
|
|
t.Fatalf("expected utlsRoundTripper, got %T", auth.httpClient.Transport)
|
|
}
|
|
if transport.dialer == proxy.Direct {
|
|
t.Fatalf("expected proxy dialer, got %T", transport.dialer)
|
|
}
|
|
}
|