#![cfg(feature = "backend-http")]
use proserpina::backend::http::{validate_provider, HttpConfig, RetryPolicy};
fn cfg(base_url: &str, key: &str) -> HttpConfig {
HttpConfig {
base_url: base_url.to_owned(),
model: "test-model".to_owned(),
api_key: key.to_owned(),
}
}
#[test]
fn validate_provider_rejects_a_bad_key() {
let config = cfg("https://api.deepseek.com/v1", "sk-definitely-not-real");
let policy = RetryPolicy::NONE; let result = validate_provider(&config, &policy);
assert!(result.is_err(), "a fake key should be rejected");
}
#[test]
fn validate_provider_rejects_a_bad_host() {
let config = cfg("https://nonexistent-host-invalid.example/v1", "any-key");
let policy = RetryPolicy::NONE;
let result = validate_provider(&config, &policy);
assert!(result.is_err(), "a bad host should fail");
}