From 8dd77584e1033bf40172399eef0517f6a086c3a7 Mon Sep 17 00:00:00 2001 From: perf3ct Date: Thu, 3 Jul 2025 15:56:49 +0000 Subject: [PATCH] fix(tests): fix timestamps in tests --- tests/integration_webdav_first_time_scan_tests.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/integration_webdav_first_time_scan_tests.rs b/tests/integration_webdav_first_time_scan_tests.rs index 1fd462b..19717f3 100644 --- a/tests/integration_webdav_first_time_scan_tests.rs +++ b/tests/integration_webdav_first_time_scan_tests.rs @@ -2,7 +2,7 @@ use tokio; use uuid::Uuid; use chrono::Utc; use anyhow::Result; -use readur::models::{FileInfo, CreateWebDAVDirectory}; +use readur::models::{FileInfo, CreateWebDAVDirectory, CreateUser, UserRole}; use readur::services::webdav_service::{WebDAVService, WebDAVConfig}; use readur::db::Database; @@ -179,10 +179,17 @@ async fn create_test_database() -> Result<(Database, Uuid)> { let database = Database::new(&db_url).await?; - // Create a test user - let user_id = Uuid::new_v4(); + // Create a test user in the database + let unique_suffix = Uuid::new_v4().to_string()[..8].to_string(); + let test_user = CreateUser { + username: format!("testuser_{}", unique_suffix), + email: format!("testuser_{}@example.com", unique_suffix), + password: "password123".to_string(), + role: Some(UserRole::User), + }; + let created_user = database.create_user(test_user).await?; - Ok((database, user_id)) + Ok((database, created_user.id)) } #[tokio::test]