This commit is contained in:
dal 2025-03-21 10:44:53 -06:00
parent 3fd040b625
commit 1513a39268
No known key found for this signature in database
GPG Key ID: 16F4B0E1E9F61122
22 changed files with 43 additions and 47 deletions

View File

@ -1100,7 +1100,7 @@ mod tests {
setup(); setup();
// Create agent first // Create agent first
let mut agent = Agent::new( let agent = Agent::new(
"o1".to_string(), "o1".to_string(),
HashMap::new(), HashMap::new(),
Uuid::new_v4(), Uuid::new_v4(),
@ -1133,7 +1133,7 @@ mod tests {
setup(); setup();
// Create LLM client and agent // Create LLM client and agent
let mut agent = Agent::new( let agent = Agent::new(
"o1".to_string(), "o1".to_string(),
HashMap::new(), HashMap::new(),
Uuid::new_v4(), Uuid::new_v4(),

View File

@ -1058,9 +1058,9 @@ mod tests {
use chrono::Utc; use chrono::Utc;
use database::{ use database::{
models::DashboardFile, models::DashboardFile,
types::{DashboardYml, Version}, types::DashboardYml,
}; };
use serde_json::json;
use uuid::Uuid; use uuid::Uuid;
// Mock functions for testing // Mock functions for testing

View File

@ -15,7 +15,7 @@ use database::{
use diesel::insert_into; use diesel::insert_into;
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::{self, json, Value}; use serde_json::{self, Value};
use tracing::debug; use tracing::debug;
use uuid::Uuid; use uuid::Uuid;

View File

@ -16,7 +16,7 @@ use tracing::{debug, error, info};
use super::{ use super::{
common::{ common::{
apply_modifications_to_content, FileModificationBatch, ModificationResult, ModificationResult,
ModifyFilesOutput, ModifyFilesParams, process_dashboard_file_modification, ModifyFilesOutput, ModifyFilesParams, process_dashboard_file_modification,
}, },
file_types::file::FileWithId, file_types::file::FileWithId,

View File

@ -3,24 +3,21 @@ use std::{env, sync::Arc, time::Instant};
use anyhow::Result; use anyhow::Result;
use async_trait::async_trait; use async_trait::async_trait;
use braintrust::{get_prompt_system_message, BraintrustClient}; use braintrust::{get_prompt_system_message, BraintrustClient};
use chrono::Utc;
use database::{ use database::{
enums::Verification, models::MetricFile, pool::get_pg_pool, schema::metric_files, models::MetricFile, pool::get_pg_pool, schema::metric_files,
types::MetricYml, types::MetricYml,
}; };
use diesel::{upsert::excluded, ExpressionMethods, QueryDsl}; use diesel::{upsert::excluded, ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use indexmap::IndexMap; use indexmap::IndexMap;
use query_engine::data_types::DataType; use query_engine::data_types::DataType;
use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
use tracing::{debug, error, info}; use tracing::{debug, error, info};
use uuid::Uuid; use uuid::Uuid;
use super::{ use super::{
common::{ common::{
apply_modifications_to_content, process_metric_file_modification, FileModification, process_metric_file_modification, ModificationResult, ModifyFilesOutput,
FileModificationBatch, Modification, ModificationResult, ModifyFilesOutput,
ModifyFilesParams, ModifyFilesParams,
}, },
file_types::file::FileWithId, file_types::file::FileWithId,
@ -160,7 +157,7 @@ impl ToolExecutor for ModifyMetricFilesTool {
// Process results and generate output message // Process results and generate output message
let duration = start_time.elapsed().as_millis() as i64; let duration = start_time.elapsed().as_millis() as i64;
let mut output = ModifyFilesOutput { let output = ModifyFilesOutput {
message: String::new(), message: String::new(),
files: Vec::new(), files: Vec::new(),
duration, duration,

View File

@ -84,7 +84,7 @@ pub async fn get_chat_exists(chat_id: &Uuid) -> Result<bool> {
mod tests { mod tests {
use super::*; use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType}; use database::enums::{AssetPermissionRole, AssetType, IdentityType};
use sharing::create_share;
use uuid::Uuid; use uuid::Uuid;
// Mock function to test permission checking // Mock function to test permission checking

View File

@ -110,7 +110,7 @@ pub async fn list_chat_sharing_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
#[tokio::test] #[tokio::test]
async fn test_list_chat_sharing_handler() { async fn test_list_chat_sharing_handler() {

View File

@ -435,8 +435,8 @@ pub async fn add_assets_to_collection_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_add_assets_to_collection_handler() { async fn test_add_assets_to_collection_handler() {

View File

@ -220,9 +220,9 @@ pub async fn add_dashboards_to_collection_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_add_dashboards_to_collection_handler() { async fn test_add_dashboards_to_collection_handler() {

View File

@ -121,9 +121,9 @@ pub async fn remove_metrics_from_collection_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_remove_metrics_from_collection_handler() { async fn test_remove_metrics_from_collection_handler() {

View File

@ -186,7 +186,7 @@ async fn update_collection_record(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use database::models::Collection;
use std::sync::Once; use std::sync::Once;
use uuid::Uuid; use uuid::Uuid;

View File

@ -132,8 +132,8 @@ pub async fn create_dashboard_handler(user_id: &Uuid) -> Result<BusterDashboardR
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_create_dashboard_handler() { async fn test_create_dashboard_handler() {

View File

@ -128,9 +128,9 @@ pub async fn create_dashboard_sharing_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use database::enums::AssetPermissionRole;
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_create_dashboard_sharing_handler() { async fn test_create_dashboard_sharing_handler() {

View File

@ -220,9 +220,9 @@ pub async fn add_metric_to_collections_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType};
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_add_metric_to_collections_handler() { async fn test_add_metric_to_collections_handler() {

View File

@ -128,9 +128,9 @@ pub async fn delete_metrics_handler(request: DeleteMetricsRequest, _user_id: &Uu
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; 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 // We removed the problematic mock implementation that was causing compilation errors
// The real database connection will be mocked in integration tests // The real database connection will be mocked in integration tests

View File

@ -116,9 +116,9 @@ pub async fn post_metric_dashboard_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; 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 // We removed the problematic mock implementation that was causing compilation errors
// The real database operations will be tested in integration tests // The real database operations will be tested in integration tests

View File

@ -79,7 +79,7 @@ pub async fn delete_metric_sharing_handler(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
#[tokio::test] #[tokio::test]
async fn test_delete_metric_sharing_handler() { async fn test_delete_metric_sharing_handler() {

View File

@ -1,6 +1,6 @@
use anyhow::Result; use anyhow::Result;
use database::{ use database::{
enums::{AssetType, Verification}, enums::AssetType,
pool::get_pg_pool, pool::get_pg_pool,
schema::collections_to_assets, schema::collections_to_assets,
}; };
@ -11,7 +11,7 @@ use uuid::Uuid;
// Import the common setup and test utilities // Import the common setup and test utilities
use super::{ use super::{
associate_metric_with_dashboard, cleanup_metric_dashboard_associations, cleanup_metric_dashboard_associations,
cleanup_test_data, create_test_dashboard, create_test_metric, cleanup_test_data, create_test_dashboard, create_test_metric,
insert_test_dashboard, insert_test_metric, setup_test_environment insert_test_dashboard, insert_test_metric, setup_test_environment
}; };

View File

@ -8,7 +8,6 @@ use database::{
use diesel::{ExpressionMethods, QueryDsl}; use diesel::{ExpressionMethods, QueryDsl};
use diesel_async::RunQueryDsl; use diesel_async::RunQueryDsl;
use handlers::metrics::{update_metric_handler, UpdateMetricRequest}; use handlers::metrics::{update_metric_handler, UpdateMetricRequest};
use serde_json::Value;
use uuid::Uuid; use uuid::Uuid;
// Import the common setup and test data functions // Import the common setup and test data functions

View File

@ -273,9 +273,9 @@ pub async fn check_permissions(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType}; use database::enums::AssetPermissionRole;
use uuid::Uuid;
#[tokio::test] #[tokio::test]
async fn test_has_permission_logic() { async fn test_has_permission_logic() {

View File

@ -173,8 +173,8 @@ pub async fn create_shares_bulk(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use crate::errors::SharingError;
use database::enums::{AssetPermissionRole, AssetType, IdentityType}; use database::enums::{AssetPermissionRole, AssetType};
use uuid::Uuid; use uuid::Uuid;
#[test] #[test]

View File

@ -98,7 +98,7 @@ pub async fn remove_share_by_email(
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use database::enums::{AssetPermissionRole, AssetType, IdentityType}; use database::enums::AssetType;
use uuid::Uuid; use uuid::Uuid;
#[test] #[test]