chore: turn clippy on for test code (#4817)

This commit is contained in:
Jack Amadeo
2025-09-26 00:06:07 -04:00
committed by GitHub
parent f5877a9996
commit 757ceb6109
38 changed files with 660 additions and 849 deletions
-2
View File
@@ -391,7 +391,6 @@ pub fn routes(state: Arc<AppState>) -> Router {
mod tests {
use super::*;
use axum::{body::Body, http::Request};
use serde_json::json;
use tower::ServiceExt;
#[tokio::test(flavor = "multi_thread")]
@@ -424,7 +423,6 @@ mod tests {
let state = AppState::new().await.unwrap();
let app = routes(state);
let large_data = "a".repeat(30 * 1024 * 1024); // 30MB
let request = Request::builder()
.uri("/audio/transcribe")
.method("POST")
+6 -12
View File
@@ -631,25 +631,19 @@ mod tests {
#[test]
fn test_make_full() {
assert_eq!(
make_full_cmd("uvx", &vec!["mcp_slack".to_string()]),
make_full_cmd("uvx", &["mcp_slack".to_string()]),
"uvx mcp_slack"
);
assert_eq!(
make_full_cmd("uvx", &vec!["mcp_slack ".to_string()]),
make_full_cmd("uvx", &["mcp_slack ".to_string()]),
"uvx mcp_slack"
);
assert_eq!(
make_full_cmd(
"uvx",
&vec!["mcp_slack".to_string(), "--verbose".to_string()]
),
make_full_cmd("uvx", &["mcp_slack".to_string(), "--verbose".to_string()]),
"uvx mcp_slack --verbose"
);
assert_eq!(
make_full_cmd(
"uvx",
&vec!["mcp_slack".to_string(), " --verbose".to_string()]
),
make_full_cmd("uvx", &["mcp_slack".to_string(), " --verbose".to_string()]),
"uvx mcp_slack --verbose"
);
}
@@ -1093,14 +1087,14 @@ mod tests {
// With bypass enabled, any command should be allowed regardless of allowlist
assert!(is_command_allowed(
"uvx",
&vec!["unauthorized_command".to_string()]
&["unauthorized_command".to_string()]
));
// Test case insensitivity
env::set_var("GOOSE_ALLOWLIST_BYPASS", "TRUE");
assert!(is_command_allowed(
"uvx",
&vec!["unauthorized_command".to_string()]
&["unauthorized_command".to_string()]
));
// Clean up
@@ -129,6 +129,6 @@ recipe: recipe_content
let result = RecipeManifestMetadata::from_yaml_file(&file_path).unwrap();
assert_eq!(result.name, "Test Recipe");
assert_eq!(result.is_global, true);
assert!(result.is_global);
}
}
-43
View File
@@ -557,58 +557,15 @@ pub fn routes(state: Arc<AppState>) -> Router {
#[cfg(test)]
mod tests {
use super::*;
use goose::conversation::message::Message;
use goose::{
model::ModelConfig,
providers::{
base::{Provider, ProviderUsage, Usage},
errors::ProviderError,
},
};
#[derive(Clone)]
struct MockProvider {
model_config: ModelConfig,
}
#[async_trait::async_trait]
impl Provider for MockProvider {
fn metadata() -> goose::providers::base::ProviderMetadata {
goose::providers::base::ProviderMetadata::empty()
}
async fn complete_with_model(
&self,
_model_config: &ModelConfig,
_system: &str,
_messages: &[Message],
_tools: &[rmcp::model::Tool],
) -> anyhow::Result<(Message, ProviderUsage), ProviderError> {
Ok((
Message::assistant().with_text("Mock response"),
ProviderUsage::new("mock".to_string(), Usage::default()),
))
}
fn get_model_config(&self) -> ModelConfig {
self.model_config.clone()
}
}
mod integration_tests {
use super::*;
use axum::{body::Body, http::Request};
use goose::conversation::message::Message;
use serde_json::json;
use tower::ServiceExt;
#[tokio::test(flavor = "multi_thread")]
async fn test_reply_endpoint() {
let mock_model_config = ModelConfig::new("test-model").unwrap();
let mock_provider = MockProvider {
model_config: mock_model_config,
};
let state = AppState::new().await.unwrap();
let app = routes(state);