use bytes::Bytes;
use http::{HeaderMap, Method};
use crate::types::{AgentType, ApiFormat, ChannelConfig, ConnectionContext, ProxyRequest};
#[must_use]
pub fn test_proxy_request() -> ProxyRequest {
ProxyRequest::new(
Method::POST,
"/v1/messages".into(),
HeaderMap::new(),
Bytes::from(
r#"{"model":"claude-sonnet","max_tokens":1024,"messages":[{"role":"user","content":"hello"}]}"#,
),
)
}
#[must_use]
pub fn test_proxy_request_streaming() -> ProxyRequest {
ProxyRequest::new(
Method::POST,
"/v1/messages".into(),
HeaderMap::new(),
Bytes::from(
r#"{"model":"claude-sonnet","max_tokens":1024,"messages":[{"role":"user","content":"hello"}],"stream":true}"#,
),
)
}
#[must_use]
pub fn test_proxy_request_with_body(body: impl Into<Bytes>) -> ProxyRequest {
ProxyRequest::new(
Method::POST,
"/v1/messages".into(),
HeaderMap::new(),
body.into(),
)
}
#[must_use]
pub fn test_connection_context() -> ConnectionContext {
ConnectionContext::new(
1,
AgentType::Claude,
None,
Some(ApiFormat::AnthropicMessages),
)
}
#[must_use]
pub fn test_connection_context_with_role(role: impl Into<String>) -> ConnectionContext {
ConnectionContext::new(
1,
AgentType::Claude,
Some(role.into()),
Some(ApiFormat::AnthropicMessages),
)
}
#[must_use]
pub fn test_channel_config(base_url: impl Into<String>) -> ChannelConfig {
ChannelConfig {
url: base_url.into(),
api_key: secrecy::SecretString::from("sk-test-channel-key"),
protocol: ApiFormat::AnthropicMessages,
name: "test-channel".into(),
rewrite_path: None,
}
}
#[must_use]
pub fn test_channel_config_openai(base_url: impl Into<String>) -> ChannelConfig {
ChannelConfig {
url: base_url.into(),
api_key: secrecy::SecretString::from("sk-test-openai-key"),
protocol: ApiFormat::OpenaiChat,
name: "test-openai-channel".into(),
rewrite_path: None,
}
}