use anthropic_async::AnthropicConfig;
use anthropic_async::Client;
use anthropic_async::types::ModelListParams;
use wiremock::Mock;
use wiremock::MockServer;
use wiremock::ResponseTemplate;
use wiremock::matchers::header;
use wiremock::matchers::header_exists;
use wiremock::matchers::method;
use wiremock::matchers::path;

#[tokio::test]
async fn test_both_auth_sends_both_headers() {
    let server = MockServer::start().await;

    Mock::given(method("GET"))
        .and(path("/v1/models"))
        .and(header_exists("x-api-key"))
        .and(header("authorization", "Bearer t123"))
        .respond_with(ResponseTemplate::new(200).set_body_string(r#"{"data":[],"has_more":false}"#))
        .mount(&server)
        .await;

    let cfg = AnthropicConfig::new()
        .with_api_base(server.uri())
        .with_both("k123", "t123");

    let client = Client::with_config(cfg);
    let _ = client
        .models()
        .list(&ModelListParams::default())
        .await
        .unwrap();
}
