mirror of https://github.com/buster-so/buster.git
clean up
This commit is contained in:
parent
3fd040b625
commit
1513a39268
|
@ -1100,7 +1100,7 @@ mod tests {
|
|||
setup();
|
||||
|
||||
// Create agent first
|
||||
let mut agent = Agent::new(
|
||||
let agent = Agent::new(
|
||||
"o1".to_string(),
|
||||
HashMap::new(),
|
||||
Uuid::new_v4(),
|
||||
|
@ -1133,7 +1133,7 @@ mod tests {
|
|||
setup();
|
||||
|
||||
// Create LLM client and agent
|
||||
let mut agent = Agent::new(
|
||||
let agent = Agent::new(
|
||||
"o1".to_string(),
|
||||
HashMap::new(),
|
||||
Uuid::new_v4(),
|
||||
|
|
|
@ -1058,9 +1058,9 @@ mod tests {
|
|||
use chrono::Utc;
|
||||
use database::{
|
||||
models::DashboardFile,
|
||||
types::{DashboardYml, Version},
|
||||
types::DashboardYml,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
// Mock functions for testing
|
||||
|
|
|
@ -15,7 +15,7 @@ use database::{
|
|||
use diesel::insert_into;
|
||||
use diesel_async::RunQueryDsl;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{self, json, Value};
|
||||
use serde_json::{self, Value};
|
||||
use tracing::debug;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ use tracing::{debug, error, info};
|
|||
|
||||
use super::{
|
||||
common::{
|
||||
apply_modifications_to_content, FileModificationBatch, ModificationResult,
|
||||
ModificationResult,
|
||||
ModifyFilesOutput, ModifyFilesParams, process_dashboard_file_modification,
|
||||
},
|
||||
file_types::file::FileWithId,
|
||||
|
|
|
@ -3,24 +3,21 @@ use std::{env, sync::Arc, time::Instant};
|
|||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use braintrust::{get_prompt_system_message, BraintrustClient};
|
||||
use chrono::Utc;
|
||||
use database::{
|
||||
enums::Verification, models::MetricFile, pool::get_pg_pool, schema::metric_files,
|
||||
models::MetricFile, pool::get_pg_pool, schema::metric_files,
|
||||
types::MetricYml,
|
||||
};
|
||||
use diesel::{upsert::excluded, ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use indexmap::IndexMap;
|
||||
use query_engine::data_types::DataType;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use tracing::{debug, error, info};
|
||||
use uuid::Uuid;
|
||||
|
||||
use super::{
|
||||
common::{
|
||||
apply_modifications_to_content, process_metric_file_modification, FileModification,
|
||||
FileModificationBatch, Modification, ModificationResult, ModifyFilesOutput,
|
||||
process_metric_file_modification, ModificationResult, ModifyFilesOutput,
|
||||
ModifyFilesParams,
|
||||
},
|
||||
file_types::file::FileWithId,
|
||||
|
@ -160,7 +157,7 @@ impl ToolExecutor for ModifyMetricFilesTool {
|
|||
|
||||
// Process results and generate output message
|
||||
let duration = start_time.elapsed().as_millis() as i64;
|
||||
let mut output = ModifyFilesOutput {
|
||||
let output = ModifyFilesOutput {
|
||||
message: String::new(),
|
||||
files: Vec::new(),
|
||||
duration,
|
||||
|
|
|
@ -84,7 +84,7 @@ pub async fn get_chat_exists(chat_id: &Uuid) -> Result<bool> {
|
|||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use sharing::create_share;
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
// Mock function to test permission checking
|
||||
|
|
|
@ -110,7 +110,7 @@ pub async fn list_chat_sharing_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_list_chat_sharing_handler() {
|
||||
|
|
|
@ -435,8 +435,8 @@ pub async fn add_assets_to_collection_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_add_assets_to_collection_handler() {
|
||||
|
|
|
@ -220,9 +220,9 @@ pub async fn add_dashboards_to_collection_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_add_dashboards_to_collection_handler() {
|
||||
|
|
|
@ -121,9 +121,9 @@ pub async fn remove_metrics_from_collection_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_remove_metrics_from_collection_handler() {
|
||||
|
|
|
@ -186,7 +186,7 @@ async fn update_collection_record(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::models::Collection;
|
||||
|
||||
use std::sync::Once;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
|
|
@ -132,8 +132,8 @@ pub async fn create_dashboard_handler(user_id: &Uuid) -> Result<BusterDashboardR
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_create_dashboard_handler() {
|
||||
|
|
|
@ -128,9 +128,9 @@ pub async fn create_dashboard_sharing_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::AssetPermissionRole;
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_create_dashboard_sharing_handler() {
|
||||
|
|
|
@ -220,9 +220,9 @@ pub async fn add_metric_to_collections_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use uuid::Uuid;
|
||||
|
||||
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_add_metric_to_collections_handler() {
|
||||
|
|
|
@ -128,9 +128,9 @@ pub async fn delete_metrics_handler(request: DeleteMetricsRequest, _user_id: &Uu
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use diesel::result::Error as DieselError;
|
||||
use mockall::predicate::*;
|
||||
use mockall::mock;
|
||||
|
||||
|
||||
|
||||
|
||||
// We removed the problematic mock implementation that was causing compilation errors
|
||||
// The real database connection will be mocked in integration tests
|
||||
|
|
|
@ -116,9 +116,9 @@ pub async fn post_metric_dashboard_handler(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use diesel::result::Error as DieselError;
|
||||
use mockall::predicate::*;
|
||||
use mockall::mock;
|
||||
|
||||
|
||||
|
||||
|
||||
// We removed the problematic mock implementation that was causing compilation errors
|
||||
// The real database operations will be tested in integration tests
|
||||
|
|
|
@ -79,7 +79,7 @@ pub async fn delete_metric_sharing_handler(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_delete_metric_sharing_handler() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use anyhow::Result;
|
||||
use database::{
|
||||
enums::{AssetType, Verification},
|
||||
enums::AssetType,
|
||||
pool::get_pg_pool,
|
||||
schema::collections_to_assets,
|
||||
};
|
||||
|
@ -11,7 +11,7 @@ use uuid::Uuid;
|
|||
|
||||
// Import the common setup and test utilities
|
||||
use super::{
|
||||
associate_metric_with_dashboard, cleanup_metric_dashboard_associations,
|
||||
cleanup_metric_dashboard_associations,
|
||||
cleanup_test_data, create_test_dashboard, create_test_metric,
|
||||
insert_test_dashboard, insert_test_metric, setup_test_environment
|
||||
};
|
||||
|
|
|
@ -8,7 +8,6 @@ use database::{
|
|||
use diesel::{ExpressionMethods, QueryDsl};
|
||||
use diesel_async::RunQueryDsl;
|
||||
use handlers::metrics::{update_metric_handler, UpdateMetricRequest};
|
||||
use serde_json::Value;
|
||||
use uuid::Uuid;
|
||||
|
||||
// Import the common setup and test data functions
|
||||
|
|
|
@ -273,9 +273,9 @@ pub async fn check_permissions(
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use uuid::Uuid;
|
||||
|
||||
use database::enums::AssetPermissionRole;
|
||||
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_has_permission_logic() {
|
||||
|
|
|
@ -173,8 +173,8 @@ pub async fn create_shares_bulk(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::errors::SharingError;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
|
||||
use database::enums::{AssetPermissionRole, AssetType};
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -98,7 +98,7 @@ pub async fn remove_share_by_email(
|
|||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
|
||||
use database::enums::AssetType;
|
||||
use uuid::Uuid;
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in New Issue