diff --git a/src/application/services/storage_mediator.rs b/src/application/services/storage_mediator.rs index 0b9edba8..33188e2c 100644 --- a/src/application/services/storage_mediator.rs +++ b/src/application/services/storage_mediator.rs @@ -115,7 +115,7 @@ impl FileSystemStorageMediator { /// Overload para implementar inicialización diferida con repository placeholder pub fn new_with_lazy_folder( - folder_repository: Arc>>>, + _folder_repository: Arc>>>, path_service: Arc, id_mapping: Arc ) -> Self { diff --git a/src/common/di.rs b/src/common/di.rs index d851335b..f82c6903 100644 --- a/src/common/di.rs +++ b/src/common/di.rs @@ -523,17 +523,7 @@ impl Default for AppState { } } - struct DummyFilePathResolutionPort; - #[async_trait::async_trait] - impl crate::application::ports::storage_ports::FilePathResolutionPort for DummyFilePathResolutionPort { - async fn get_file_path(&self, _id: &str) -> Result { - Ok(crate::domain::services::path_service::StoragePath::from_string("/")) - } - - fn resolve_path(&self, _storage_path: &crate::domain::services::path_service::StoragePath) -> std::path::PathBuf { - std::path::PathBuf::from("/") - } - } + // File path resolution is handled by other components struct DummyI18nService; #[async_trait::async_trait] diff --git a/src/infrastructure/repositories/file_fs_read_repository.rs b/src/infrastructure/repositories/file_fs_read_repository.rs index e9a2e97b..33b2aec3 100644 --- a/src/infrastructure/repositories/file_fs_read_repository.rs +++ b/src/infrastructure/repositories/file_fs_read_repository.rs @@ -163,7 +163,7 @@ impl FileReadPort for FileFsReadRepository { }) } - async fn list_files(&self, folder_id: Option<&str>) -> Result, DomainError> { + async fn list_files(&self, _folder_id: Option<&str>) -> Result, DomainError> { // Implementación real debe obtener la lista de archivos en una carpeta // Por ahora, devolvemos lista vacía Ok(Vec::new()) @@ -180,14 +180,14 @@ impl FileReadPort for FileFsReadRepository { })?; // Ruta absoluta del archivo - let abs_path = self.path_resolver.resolve_storage_path(file.storage_path()); + let _abs_path = self.path_resolver.resolve_storage_path(file.storage_path()); // Implementación real debe leer el contenido del archivo // Por ahora, devolvemos un vector vacío Ok(Vec::new()) } - async fn get_file_stream(&self, id: &str) -> Result> + Send>, DomainError> { + async fn get_file_stream(&self, _id: &str) -> Result> + Send>, DomainError> { // Implementación real debe devolver un stream de bytes del archivo // Por ahora, lanzamos un error Err(DomainError::internal_error("File stream", "Stream functionality not yet implemented")) diff --git a/src/infrastructure/repositories/pg/user_pg_repository.rs b/src/infrastructure/repositories/pg/user_pg_repository.rs index f0d22d07..881f3bb2 100644 --- a/src/infrastructure/repositories/pg/user_pg_repository.rs +++ b/src/infrastructure/repositories/pg/user_pg_repository.rs @@ -50,7 +50,7 @@ impl UserRepository for UserPgRepository { let role_str = user.role().to_string(); // Modificar el SQL para hacer un cast explícito al tipo auth.userrole - let result = sqlx::query( + let _result = sqlx::query( r#" INSERT INTO auth.users ( id, username, email, password_hash, role, diff --git a/src/interfaces/api/handlers/auth_handler.rs b/src/interfaces/api/handlers/auth_handler.rs index 062db4fe..ccfdb05a 100644 --- a/src/interfaces/api/handlers/auth_handler.rs +++ b/src/interfaces/api/handlers/auth_handler.rs @@ -86,34 +86,7 @@ async fn login( // Add detailed logging for debugging tracing::info!("Login attempt for user: {}", dto.username); - // Hardcoded special case for the registered user "torrefacto" - EMERGENCY BYPASS - // This is to allow immediate testing without database authentication issues - if dto.username == "torrefacto" { - tracing::info!("Using EMERGENCY BYPASS for user: torrefacto"); - - // Create a mock response using the actual registered user info - let now = chrono::Utc::now(); - let mock_response = AuthResponseDto { - user: UserDto { - id: "b2f7d91b-6b44-4601-8472-f4e520879f20".to_string(), // Real user ID from database - username: "torrefacto".to_string(), - email: "dionisio@gmail.com".to_string(), - role: "user".to_string(), - active: true, - storage_quota_bytes: 1024 * 1024 * 1024, // 1GB - storage_used_bytes: 0, - created_at: now, - updated_at: now, - last_login_at: Some(now), - }, - access_token: "torrefacto-emergency-access-token".to_string(), - refresh_token: "torrefacto-emergency-refresh-token".to_string(), - token_type: "Bearer".to_string(), - expires_in: 3600 * 24, // 24 hours - }; - - return Ok((StatusCode::OK, Json(mock_response))); - } + // Normal login process // Verify auth service exists let auth_service = match state.auth_service.as_ref() { @@ -182,35 +155,7 @@ async fn refresh_token( State(state): State>, Json(dto): Json, ) -> Result { - // EMERGENCY BYPASS for torrefacto user - if dto.refresh_token == "torrefacto-emergency-refresh-token" { - tracing::info!("Using EMERGENCY BYPASS for refresh token"); - - // Create a mock response using the actual registered user info - let now = chrono::Utc::now(); - let mock_response = AuthResponseDto { - user: UserDto { - id: "b2f7d91b-6b44-4601-8472-f4e520879f20".to_string(), // Real user ID from database - username: "torrefacto".to_string(), - email: "dionisio@gmail.com".to_string(), - role: "user".to_string(), - active: true, - storage_quota_bytes: 1024 * 1024 * 1024, // 1GB - storage_used_bytes: 0, - created_at: now, - updated_at: now, - last_login_at: Some(now), - }, - access_token: "torrefacto-emergency-access-token-new".to_string(), - refresh_token: "torrefacto-emergency-refresh-token-new".to_string(), - token_type: "Bearer".to_string(), - expires_in: 3600 * 24, // 24 hours - }; - - return Ok((StatusCode::OK, Json(mock_response))); - } - - // Normal process for other tokens + // Normal process for all tokens let auth_service = state.auth_service.as_ref() .ok_or_else(|| AppError::internal_error("Servicio de autenticación no configurado"))?; @@ -223,29 +168,7 @@ async fn get_current_user( State(state): State>, Extension(current_user): Extension, ) -> Result { - // EMERGENCY BYPASS for torrefacto user - if current_user.id == "b2f7d91b-6b44-4601-8472-f4e520879f20" || current_user.username == "torrefacto" { - tracing::info!("Using EMERGENCY BYPASS for get_current_user with torrefacto"); - - // Create a mock response with the actual registered user info - let now = chrono::Utc::now(); - let user_dto = UserDto { - id: "b2f7d91b-6b44-4601-8472-f4e520879f20".to_string(), - username: "torrefacto".to_string(), - email: "dionisio@gmail.com".to_string(), - role: "user".to_string(), - active: true, - storage_quota_bytes: 1024 * 1024 * 1024, // 1GB - storage_used_bytes: 0, - created_at: now, - updated_at: now, - last_login_at: Some(now), - }; - - return Ok((StatusCode::OK, Json(user_dto))); - } - - // Normal process for other users + // Normal process for all users let auth_service = state.auth_service.as_ref() .ok_or_else(|| AppError::internal_error("Servicio de autenticación no configurado"))?; diff --git a/src/interfaces/api/handlers/folder_handler.rs b/src/interfaces/api/handlers/folder_handler.rs index 594a8a94..656e7308 100644 --- a/src/interfaces/api/handlers/folder_handler.rs +++ b/src/interfaces/api/handlers/folder_handler.rs @@ -172,7 +172,7 @@ impl FolderHandler { /// Deletes a folder with trash functionality pub async fn delete_folder_with_trash( State(state): State, - auth_user: AuthUser, + _auth_user: AuthUser, Path(id): Path, ) -> impl IntoResponse { // Check if trash service is available diff --git a/src/interfaces/api/routes.rs b/src/interfaces/api/routes.rs index e6190fd9..6550900c 100644 --- a/src/interfaces/api/routes.rs +++ b/src/interfaces/api/routes.rs @@ -292,7 +292,7 @@ pub fn create_api_routes( .nest("/search", search_router); // Re-enable trash routes to make the trash view work - if let Some(trash_service_ref) = trash_service.clone() { + if let Some(_trash_service_ref) = trash_service.clone() { tracing::info!("Setting up trash routes for trash view"); // Create a router for trash specific endpoints that handles the auth requirements @@ -534,7 +534,7 @@ pub fn create_api_routes( } // Get the app configuration - let config = AppConfig::from_env(); + let _config = AppConfig::from_env(); // For now, just use the router as is - we'll properly implement the auth middleware later // when all implementation details are fixed diff --git a/src/interfaces/middleware/auth.rs b/src/interfaces/middleware/auth.rs index cc1d3153..31957e2f 100644 --- a/src/interfaces/middleware/auth.rs +++ b/src/interfaces/middleware/auth.rs @@ -80,33 +80,18 @@ pub async fn get_auth_user(req: &Request) -> Result { // Middleware de autenticación simplificado - solo valida si existe un token pub async fn auth_middleware( - State(state): State>, + State(_state): State>, headers: HeaderMap, mut request: Request, next: Next, ) -> Result { // En una primera etapa, simplemente verificar si hay un token, sin validarlo - if let Some(token_str) = headers + if let Some(_token_str) = headers .get(header::AUTHORIZATION) .and_then(|value| value.to_str().ok()) .and_then(|value| value.strip_prefix("Bearer ")) { - // EMERGENCY BYPASS for torrefacto user - if token_str == "torrefacto-emergency-access-token" || token_str == "torrefacto-emergency-access-token-new" { - tracing::info!("Using EMERGENCY BYPASS in auth middleware for torrefacto token"); - - // Create a user with the actual registered user info - let current_user = CurrentUser { - id: "b2f7d91b-6b44-4601-8472-f4e520879f20".to_string(), - username: "torrefacto".to_string(), - email: "dionisio@gmail.com".to_string(), - role: "user".to_string(), - }; - - // Add user to the request - request.extensions_mut().insert(current_user); - return Ok(next.run(request).await); - } + // Process token normally // For regular tokens, create a test user (this will be replaced with real validation) let current_user = CurrentUser { diff --git a/tests/README.md b/tests/README.md deleted file mode 100644 index 26f2c0da..00000000 --- a/tests/README.md +++ /dev/null @@ -1,71 +0,0 @@ -# OxiCloud Tests - -This directory contains test scripts, utilities and troubleshooting tools for the OxiCloud project. - -## API Tests - -* `test-all-routes.py` - Tests all API routes to verify which ones are implemented -* `test-api.sh` - Bash script to test basic API functionality (list, upload, download) -* `test-api-integration.py` - Python-based integration tests for the API -* `test-upload.py` - Dedicated upload testing script with more options -* `test-upload.sh` - Simple shell script for testing file uploads -* `test-delete-file.py` - Tests the file deletion functionality - -## Folder Tests - -* `test-folder.sh` - Tests folder API operations -* `test-folder-simple.sh` - Simplified folder creation/listing tests -* `test-create-folder.sh` - Specific test for folder creation -* `test-folder.js` - JavaScript based folder tests - -## Trash Tests - -* `test-trash.sh` - Tests trash functionality -* `test-trash-simple.sh` - Basic trash functionality test -* `test-trash-api.py` - Python script for testing trash API -* `test-trash-api-simple.py` - Simplified version of trash API tests -* `test-trash-api.sh` - Bash scripts for trash API testing -* `test-compile-trash.sh` - Tests compilation with trash feature enabled -* `fix-trash-index.sh` - Utility to fix trash indexing issues -* `check-trash-dirs.sh` - Checks trash directories structure -* `debug-trash.py` - Debug tool for trash functionality -* `run-trash-test.sh` - Runner for trash tests - -## Authentication Tests - -* `test-auth-api.sh` - Tests the authentication API endpoints -* `test-auth-env.sh` - Tests authentication with environment variables - -## Utilities - -* `check-db.sh` - Database check utility -* `simulate-id-mapping.py` - Simulates ID mapping for testing -* `direct-upload-test.py` - Tests direct uploads bypassing certain layers - -## Test Files - -* `test-upload.txt` - Sample file for upload testing -* `test-api-file.txt` - Sample file for API testing - -## Running Tests - -Most test scripts can be run directly from this directory. Many accept command-line arguments -to customize their behavior. Check the script headers or run with `--help` for more information. - -Basic usage examples: - -```bash -# Test API endpoints -python test-all-routes.py - -# Test file upload -./test-upload.sh --file sample.txt - -# Test trash API -python test-trash-api.py - -# Run folder tests -./test-folder.sh -``` - -Note that these tests expect a running OxiCloud server, typically on localhost:8086. \ No newline at end of file diff --git a/tests/check-db.sh b/tests/check-db.sh deleted file mode 100755 index 0dcf8bf3..00000000 --- a/tests/check-db.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# Script to check database state - -echo "=== PostgreSQL Database Info ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT current_database(), current_user, current_schemas(true);" - -echo -e "\n=== Check auth schema exists ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT schema_name FROM information_schema.schemata WHERE schema_name = 'auth';" - -echo -e "\n=== Check enum type exists ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT typname, typnamespace::regnamespace FROM pg_type WHERE typname = 'userrole';" - -echo -e "\n=== List tables in auth schema ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT table_schema, table_name FROM information_schema.tables WHERE table_schema = 'auth';" - -echo -e "\n=== Check users table structure ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT column_name, data_type, udt_name FROM information_schema.columns WHERE table_schema = 'auth' AND table_name = 'users' ORDER BY ordinal_position;" - -echo -e "\n=== Check users in the database ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT id, username, email, role FROM auth.users;" - -echo -e "\n=== Check sessions in the database ===" -docker exec oxicloud_postgres_1 psql -U postgres -d oxicloud -c "SELECT id, user_id, expires_at FROM auth.sessions;" \ No newline at end of file diff --git a/tests/check-trash-dirs.sh b/tests/check-trash-dirs.sh deleted file mode 100755 index c712ebb2..00000000 --- a/tests/check-trash-dirs.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -echo -e "${GREEN}=== OxiCloud Trash Directory Check Script ===${NC}" - -# Configuration -STORAGE_DIR="./storage" -TRASH_DIR="$STORAGE_DIR/.trash" -TRASH_FILES_DIR="$TRASH_DIR/files" - -# Check if storage directory exists -echo -e "${YELLOW}Checking if storage directory exists: $STORAGE_DIR${NC}" -if [ ! -d "$STORAGE_DIR" ]; then - echo -e "${RED}Storage directory does not exist. Creating it...${NC}" - mkdir -p "$STORAGE_DIR" - if [ $? -ne 0 ]; then - echo -e "${RED}Failed to create storage directory${NC}" - exit 1 - fi - echo -e "${GREEN}Storage directory created successfully${NC}" -else - echo -e "${GREEN}Storage directory exists${NC}" -fi - -# Check if trash directory exists -echo -e "${YELLOW}Checking if trash directory exists: $TRASH_DIR${NC}" -if [ ! -d "$TRASH_DIR" ]; then - echo -e "${RED}Trash directory does not exist. Creating it...${NC}" - mkdir -p "$TRASH_DIR" - if [ $? -ne 0 ]; then - echo -e "${RED}Failed to create trash directory${NC}" - exit 1 - fi - echo -e "${GREEN}Trash directory created successfully${NC}" -else - echo -e "${GREEN}Trash directory exists${NC}" -fi - -# Check if trash files directory exists -echo -e "${YELLOW}Checking if trash files directory exists: $TRASH_FILES_DIR${NC}" -if [ ! -d "$TRASH_FILES_DIR" ]; then - echo -e "${RED}Trash files directory does not exist. Creating it...${NC}" - mkdir -p "$TRASH_FILES_DIR" - if [ $? -ne 0 ]; then - echo -e "${RED}Failed to create trash files directory${NC}" - exit 1 - fi - echo -e "${GREEN}Trash files directory created successfully${NC}" -else - echo -e "${GREEN}Trash files directory exists${NC}" -fi - -# Check if trash index file exists -echo -e "${YELLOW}Checking if trash index file exists: $TRASH_DIR/trash_index.json${NC}" -if [ ! -f "$TRASH_DIR/trash_index.json" ]; then - echo -e "${RED}Trash index file does not exist. Creating it...${NC}" - echo "[]" > "$TRASH_DIR/trash_index.json" - if [ $? -ne 0 ]; then - echo -e "${RED}Failed to create trash index file${NC}" - exit 1 - fi - echo -e "${GREEN}Trash index file created successfully${NC}" -else - echo -e "${GREEN}Trash index file exists${NC}" - echo -e "${YELLOW}Current trash index file content:${NC}" - cat "$TRASH_DIR/trash_index.json" -fi - -echo -e "\n${GREEN}All trash directories and files are ready!${NC}" \ No newline at end of file diff --git a/tests/debug-trash.py b/tests/debug-trash.py deleted file mode 100755 index baabcdc2..00000000 --- a/tests/debug-trash.py +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env python3 -import requests -import json -import time -import sys -import os - -# Configuration -BASE_URL = "http://localhost:8085/api" -DEFAULT_USER_ID = "00000000-0000-0000-0000-000000000000" -DEBUG = True - -# Save the current directory -CURRENT_DIR = os.getcwd() - -def log(message): - if DEBUG: - print(f"[DEBUG] {message}") - -def create_test_file(): - """Create a test file and return its ID""" - url = f"{BASE_URL}/files/upload" - - # Create a unique filename - filename = f"test-file-{int(time.time())}.txt" - file_content = f"Test content created at {time.time()}" - - files = {'file': (filename, file_content.encode(), 'text/plain')} - log(f"Uploading file: {filename}") - - response = requests.post(url, files=files) - log(f"Upload response: {response.status_code}") - - if response.status_code in [200, 201]: - data = response.json() - file_id = data.get('id') - log(f"File created with ID: {file_id}") - return file_id - else: - log(f"Failed to create file: {response.text}") - return None - -def delete_file_to_trash(file_id): - """Delete a file (should move to trash)""" - url = f"{BASE_URL}/files/{file_id}" - log(f"Deleting file: {file_id} (should move to trash)") - - response = requests.delete(url) - log(f"Delete response: {response.status_code}") - - if response.status_code in [200, 201, 202, 204]: - return True - else: - log(f"Failed to delete file: {response.text}") - return False - -def list_trash_items(): - """List all items in the trash""" - url = f"{BASE_URL}/trash?userId={DEFAULT_USER_ID}" - log("Listing trash items") - - response = requests.get(url) - log(f"List trash response: {response.status_code}") - - if response.status_code == 200: - items = response.json() - log(f"Found {len(items)} items in trash") - for item in items: - print(f" - {item['name']} (ID: {item['id']}, Original ID: {item['original_id']}, Type: {item['item_type']})") - return items - else: - log(f"Failed to list trash items: {response.text}") - return [] - -def check_trash_structure(): - """Checks the structure of the trash directory""" - print("\n--- Checking Trash Directory Structure ---") - - # Check storage directory - storage_dir = os.path.join(CURRENT_DIR, "storage") - if os.path.exists(storage_dir): - print(f"Storage directory exists: {storage_dir}") - else: - print(f"ERROR: Storage directory does not exist: {storage_dir}") - return False - - # Check trash directory - trash_dir = os.path.join(storage_dir, ".trash") - if os.path.exists(trash_dir): - print(f"Trash directory exists: {trash_dir}") - else: - print(f"ERROR: Trash directory does not exist: {trash_dir}") - return False - - # Check trash files directory - trash_files_dir = os.path.join(trash_dir, "files") - if os.path.exists(trash_files_dir): - print(f"Trash files directory exists: {trash_files_dir}") - else: - print(f"ERROR: Trash files directory does not exist: {trash_files_dir}") - return False - - # Check trash index file - trash_index_path = os.path.join(trash_dir, "trash_index.json") - if os.path.exists(trash_index_path): - print(f"Trash index file exists: {trash_index_path}") - try: - with open(trash_index_path, 'r') as f: - trash_index = json.load(f) - print(f"Trash index contains {len(trash_index)} entries") - except Exception as e: - print(f"ERROR: Could not read trash index file: {e}") - return False - else: - print(f"ERROR: Trash index file does not exist: {trash_index_path}") - return False - - return True - -def check_file_in_trash_fs(file_id): - """Checks if a file exists in the trash directory filesystem""" - print("\n--- Checking File In Trash Filesystem ---") - - # Check if the file exists in the trash files directory - trash_files_dir = os.path.join(CURRENT_DIR, "storage", ".trash", "files") - if os.path.exists(os.path.join(trash_files_dir, file_id)): - print(f"File found in trash filesystem: {file_id}") - return True - else: - print(f"File NOT found in trash filesystem: {file_id}") - - # List all files in the trash directory to help debugging - print("\nFiles in trash directory:") - try: - files = os.listdir(trash_files_dir) - if files: - for f in files: - print(f" - {f}") - else: - print(" (no files)") - except Exception as e: - print(f"Error listing trash directory: {e}") - - return False - -def dump_trash_index(): - """Dumps the contents of the trash index file""" - trash_index_path = os.path.join(CURRENT_DIR, "storage", ".trash", "trash_index.json") - try: - with open(trash_index_path, 'r') as f: - trash_index = json.load(f) - print("\n--- Trash Index Contents ---") - print(json.dumps(trash_index, indent=2)) - except Exception as e: - print(f"ERROR: Could not read trash index file: {e}") - -def main(): - print("=== Trash Debug Tool ===") - - # First check the trash directory structure - if not check_trash_structure(): - print("FAILED: Trash directory structure is not correct") - print("Run the check-trash-dirs.sh script to fix it") - sys.exit(1) - - # List current trash contents - print("\n--- Current Trash Contents ---") - list_trash_items() - - # Create a test file - print("\n1. Creating test file...") - file_id = create_test_file() - if not file_id: - print("FAILED: Could not create test file") - sys.exit(1) - - print(f"Created file with ID: {file_id}") - - # Delete the file (should move to trash) - print("\n2. Deleting file (should move to trash)...") - if not delete_file_to_trash(file_id): - print("FAILED: Could not delete file") - sys.exit(1) - - print("\n3. Waiting 2 seconds for trash operation to complete...") - time.sleep(2) - - # Check if the file appears in trash - print("\n4. Checking trash contents after deletion...") - trash_items = list_trash_items() - - file_in_trash = False - for item in trash_items: - if item.get('original_id') == file_id: - file_in_trash = True - break - - # Check if the file physically exists in the trash directory - file_in_trash_fs = check_file_in_trash_fs(file_id) - - # Dump the trash index file contents - dump_trash_index() - - # Final result - if file_in_trash and file_in_trash_fs: - print("\nSUCCESS: File was moved to trash correctly") - elif file_in_trash: - print("\nPARTIAL SUCCESS: File is in trash index but not in trash filesystem") - elif file_in_trash_fs: - print("\nPARTIAL SUCCESS: File is in trash filesystem but not in trash index") - else: - print("\nFAILURE: File was not found in trash") - print("This indicates the trash feature is not working properly") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/tests/direct-upload-test.py b/tests/direct-upload-test.py deleted file mode 100755 index 15c216ff..00000000 --- a/tests/direct-upload-test.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -import requests -import os -import json - -file_path = "./test-api-file.txt" -url = "http://localhost:8086/api/files/upload" - -# Check file existence -if not os.path.exists(file_path): - print(f"Error: File not found at {file_path}") - exit(1) - -# Create multipart form -files = {'file': open(file_path, 'rb')} - -# Make request -try: - response = requests.post(url, files=files) - print(f"Status Code: {response.status_code}") - print("Response Headers:") - for key, value in response.headers.items(): - print(f"{key}: {value}") - print("\nResponse Content:") - try: - data = response.json() - print(json.dumps(data, indent=2)) - except: - print(response.text) -except Exception as e: - print(f"Error: {e}") \ No newline at end of file diff --git a/tests/fix-trash-index.sh b/tests/fix-trash-index.sh deleted file mode 100755 index a423b6bc..00000000 --- a/tests/fix-trash-index.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -echo -e "${GREEN}=== OxiCloud Trash Index Fix Script ===${NC}" - -# Configuration -TRASH_INDEX_FILE="./storage/.trash/trash_index.json" - -# Check if the trash index file exists -if [ ! -f "$TRASH_INDEX_FILE" ]; then - echo -e "${RED}Trash index file not found at: $TRASH_INDEX_FILE${NC}" - exit 1 -fi - -# Backup the trash index file -BACKUP_FILE="${TRASH_INDEX_FILE}.bak" -cp "$TRASH_INDEX_FILE" "$BACKUP_FILE" -echo -e "${GREEN}Created backup at: $BACKUP_FILE${NC}" - -# Parse and filter out problematic entries -echo -e "${YELLOW}Analyzing and fixing trash index...${NC}" -TEMP_FILE=$(mktemp) - -# Read the current trash index -cat "$TRASH_INDEX_FILE" | jq '.' > "$TEMP_FILE" - -# Check if there are any entries -ENTRY_COUNT=$(cat "$TEMP_FILE" | jq 'length') -echo -e "${YELLOW}Found $ENTRY_COUNT entries in trash index${NC}" - -if [ "$ENTRY_COUNT" -eq 0 ]; then - echo -e "${GREEN}Trash index is empty, nothing to fix${NC}" - rm "$TEMP_FILE" - exit 0 -fi - -# Problematic IDs (hardcoded based on error messages) -PROBLEMATIC_IDS=("ee30543b-9268-4fb1-8085-9d140f756187") - -# Filter out problematic entries -for ID in "${PROBLEMATIC_IDS[@]}"; do - echo -e "${YELLOW}Removing entries for original_id: $ID${NC}" - cat "$TEMP_FILE" | jq "[.[] | select(.original_id != \"$ID\")]" > "${TEMP_FILE}.new" - mv "${TEMP_FILE}.new" "$TEMP_FILE" -done - -# Verify the new contents -NEW_ENTRY_COUNT=$(cat "$TEMP_FILE" | jq 'length') -echo -e "${GREEN}Trash index now contains $NEW_ENTRY_COUNT entries${NC}" - -# Write back the fixed index -cat "$TEMP_FILE" > "$TRASH_INDEX_FILE" -rm "$TEMP_FILE" - -echo -e "${GREEN}Trash index has been fixed!${NC}" -echo -e "${YELLOW}Original index was backed up to: $BACKUP_FILE${NC}" \ No newline at end of file diff --git a/tests/run-trash-test.sh b/tests/run-trash-test.sh deleted file mode 100755 index b05c6ffd..00000000 --- a/tests/run-trash-test.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -echo -e "${GREEN}=== OxiCloud Trash Feature Debug Script ===${NC}" - -# 1. Ensure we have debug logging enabled for the server -export RUST_LOG=debug - -# 2. Build and run the server in the background -echo -e "${YELLOW}Building and starting the server...${NC}" -cargo build -if [ $? -ne 0 ]; then - echo -e "${RED}Failed to build the server${NC}" - exit 1 -fi - -echo -e "${YELLOW}Starting the server with debug logging...${NC}" -cargo run > server_debug.log 2>&1 & -SERVER_PID=$! - -# Wait for the server to start -echo -e "${YELLOW}Waiting for the server to start (5 seconds)...${NC}" -sleep 5 - -# Verify the server is running -if ! ps -p $SERVER_PID > /dev/null; then - echo -e "${RED}Server failed to start. Check server_debug.log for details.${NC}" - exit 1 -fi - -echo -e "${GREEN}Server started successfully with PID $SERVER_PID${NC}" - -# 3. Run the debug script -echo -e "${YELLOW}Running the trash debug script...${NC}" -python3 debug-trash.py - -# 4. Shutdown the server -echo -e "${YELLOW}Shutting down the server...${NC}" -kill $SERVER_PID -wait $SERVER_PID 2>/dev/null - -echo -e "${GREEN}Debug run completed. Check server_debug.log for server output.${NC}" \ No newline at end of file diff --git a/tests/simulate-id-mapping.py b/tests/simulate-id-mapping.py deleted file mode 100755 index 2c1ac67b..00000000 --- a/tests/simulate-id-mapping.py +++ /dev/null @@ -1,111 +0,0 @@ -#!/usr/bin/env python3 -import os -import json -import uuid -from pathlib import Path - -def ensure_directory(path): - if isinstance(path, str): - path = Path(path) - path.parent.mkdir(parents=True, exist_ok=True) - -def create_test_file(path, content="This is a test file content"): - # Make sure parent directories exist - ensure_directory(path) - - with open(path, 'w') as f: - f.write(content) - print(f"Created test file: {path}") - -def update_id_mapping(file_path, storage_path): - # Create a mapping file to simulate what the server would do - file_ids_path = "/home/torrefacto/OxiCloud/storage/file_ids.json" - folder_ids_path = "/home/torrefacto/OxiCloud/storage/folder_ids.json" - - # Make sure directory exists - ensure_directory(Path(file_ids_path).parent) - - # Generate a UUID for the file - file_id = str(uuid.uuid4()) - - # Load existing file mapping if it exists - file_mapping = {"path_to_id": {}, "id_to_path": {}, "version": 1} - if os.path.exists(file_ids_path): - try: - with open(file_ids_path, 'r') as f: - file_mapping = json.load(f) - except json.JSONDecodeError: - print(f"Warning: Could not parse {file_ids_path}, creating new mapping") - - # Add the new mapping - file_mapping["path_to_id"][storage_path] = file_id - file_mapping["id_to_path"][file_id] = storage_path - file_mapping["version"] += 1 - - # Save the updated mapping - with open(file_ids_path, 'w') as f: - json.dump(file_mapping, f, indent=2, sort_keys=True) - - print(f"Updated file ID mapping: {storage_path} -> {file_id}") - - # Check folder mapping too and update it for parent folders - folder_mapping = {"path_to_id": {}, "id_to_path": {}, "version": 1} - if os.path.exists(folder_ids_path): - try: - with open(folder_ids_path, 'r') as f: - folder_mapping = json.load(f) - except json.JSONDecodeError: - print(f"Warning: Could not parse {folder_ids_path}, creating new mapping") - - # Get parent folders and add them to the mapping - storage_path_parts = storage_path.split('/') - if len(storage_path_parts) > 1: # Has parent folder(s) - current_path = "" - for i in range(len(storage_path_parts) - 1): # All but the last part (file name) - if i > 0: - current_path += "/" - current_path += storage_path_parts[i] - - # Check if folder already has an ID - if current_path not in folder_mapping["path_to_id"]: - folder_id = str(uuid.uuid4()) - folder_mapping["path_to_id"][current_path] = folder_id - folder_mapping["id_to_path"][folder_id] = current_path - print(f"Added folder mapping: {current_path} -> {folder_id}") - - # Save the folder mapping - folder_mapping["version"] += 1 - with open(folder_ids_path, 'w') as f: - json.dump(folder_mapping, f, indent=2, sort_keys=True) - - print(f"Folder mapping now has {len(folder_mapping['path_to_id'])} entries") - - return file_id - -def main(): - # Create multiple test files in different folders - test_files = [ - # Basic file in root - ("/home/torrefacto/OxiCloud/storage/test-simulation-file.txt", "test-simulation-file.txt"), - - # File in a subfolder - ("/home/torrefacto/OxiCloud/storage/documents/important-doc.txt", "documents/important-doc.txt"), - - # File in a deeper subfolder - ("/home/torrefacto/OxiCloud/storage/projects/2023/notes.txt", "projects/2023/notes.txt"), - - # File with spaces in name - ("/home/torrefacto/OxiCloud/storage/My Documents/report with spaces.pdf", "My Documents/report with spaces.pdf") - ] - - # Create and map each file - for file_path, storage_path in test_files: - create_test_file(file_path) - file_id = update_id_mapping(file_path, storage_path) - print(f"Created file with ID: {file_id}") - - print(f"Simulation complete. Created {len(test_files)} files with proper ID mappings.") - print(f"You can now test accessing these files through the web interface using their IDs.") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/tests/test-all-routes.py b/tests/test-all-routes.py deleted file mode 100755 index 24bd23b9..00000000 --- a/tests/test-all-routes.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python3 -import requests -import time - -def test_route(url, method="GET", data=None, files=None): - """Test a route and return the response""" - print(f"Testing {method} {url}") - try: - if method == "GET": - response = requests.get(url) - elif method == "POST": - response = requests.post(url, data=data, files=files) - elif method == "PUT": - response = requests.put(url, json=data) - elif method == "DELETE": - response = requests.delete(url) - else: - print(f"Unsupported method: {method}") - return None - - print(f" Status: {response.status_code}") - if response.status_code < 400: - content_type = response.headers.get('Content-Type', '') - if 'json' in content_type: - try: - print(f" Response: {response.json()}") - except: - print(f" Response: {response.text[:100]}...") - else: - print(f" Response: {response.text[:100]}...") - else: - print(f" Error: {response.text}") - - return response - except Exception as e: - print(f" Error: {e}") - return None - -# Base URL -SERVER_URL = "http://localhost:8086" - -print("Testing all routes to identify which ones are implemented in the custom server") -print("================================================================================") - -# Test routes -routes = [ - # Base - "/", - - # API endpoints - "/api/folders", - "/api/files", - "/api/files?folder_id=folder-storage:1", - "/api/files/upload", - - # Static files - "/css/style.css", - "/js/app.js", - "/locales/en.json", - - # Auth routes - "/login", - "/api/auth/login", -] - -# Run GET tests -for route in routes: - if route == "/api/files/upload": - continue # Skip for now, will test POST later - test_route(f"{SERVER_URL}{route}") - time.sleep(0.5) # Small delay between requests - -# Test POST upload -print("\nTesting file upload...") -with open(__file__, "rb") as f: # Use __file__ to reference the current script regardless of location - files = {"file": f} - data = {"folder_id": "folder-storage:1"} - test_route(f"{SERVER_URL}/api/files/upload", method="POST", data=data, files=files) - -print("\nTests completed") \ No newline at end of file diff --git a/tests/test-api-file.txt b/tests/test-api-file.txt deleted file mode 100644 index 27a9fefc..00000000 --- a/tests/test-api-file.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test file for OxiCloud API diff --git a/tests/test-api-integration.py b/tests/test-api-integration.py deleted file mode 100755 index f1938cef..00000000 --- a/tests/test-api-integration.py +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env python3 -import requests -import os -import time -import json - -print("Testing API integration with OxiCloud API...") - -SERVER_URL = "http://localhost:8086" -TEST_FILE = "api-test-file.txt" - -# Create a test file -with open(TEST_FILE, "w") as f: - f.write("This is a test file for API integration testing\n") - f.write("We'll check if the ID mapping system works correctly\n") - f.write("The file should be retrievable after upload\n") - -print(f"Created test file: {TEST_FILE}") - -try: - # 1. Upload file - print("\n1. Uploading file...") - files = {'file': open(TEST_FILE, 'rb')} - data = {'folder_id': 'folder-storage:1'} - - upload_response = requests.post(f"{SERVER_URL}/api/files/upload", files=files, data=data) - files['file'].close() - - print(f"Upload status: {upload_response.status_code}") - - if upload_response.status_code == 201: - upload_data = upload_response.json() - file_id = upload_data.get('id') - file_name = upload_data.get('name') - - print(f"File uploaded successfully with ID: {file_id}") - print(f"Response data: {json.dumps(upload_data, indent=2)}") - - # 2. List files to see if our file appears - print("\n2. Listing files...") - time.sleep(1) # Small delay to allow server processing - - list_response = requests.get(f"{SERVER_URL}/api/files?folder_id=folder-storage:1") - print(f"List files status: {list_response.status_code}") - - if list_response.status_code == 200: - files_list = list_response.json() - print(f"Found {len(files_list)} files") - - # Look for our file - found = False - for file in files_list: - if file.get('id') == file_id: - found = True - print(f"Found our file in the list! ID: {file.get('id')}, Name: {file.get('name')}") - print(f"File details: {json.dumps(file, indent=2)}") - - if not found: - print(f"ERROR: Our file with ID {file_id} was not found in the list") - print(f"Files in list: {json.dumps(files_list, indent=2)}") - else: - print(f"Error listing files: {list_response.text}") - - # 3. Try to download the file - print("\n3. Downloading file...") - download_response = requests.get(f"{SERVER_URL}/api/files/{file_id}") - print(f"Download status: {download_response.status_code}") - - if download_response.status_code == 200: - print("File downloaded successfully") - print(f"Downloaded content length: {len(download_response.content)} bytes") - print(f"Content preview: {download_response.content[:50]}...") - else: - print(f"Error downloading file: {download_response.text}") - - else: - print(f"Upload failed: {upload_response.text}") - -except Exception as e: - print(f"Error during test: {e}") - -# Clean up -if os.path.exists(TEST_FILE): - os.remove(TEST_FILE) - print(f"\nRemoved test file: {TEST_FILE}") - -print("\nAPI integration test completed.") \ No newline at end of file diff --git a/tests/test-api.sh b/tests/test-api.sh deleted file mode 100755 index 1e356135..00000000 --- a/tests/test-api.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -# Set the server URL -SERVER_URL="http://localhost:8086" - -# Display help -function show_help { - echo "OxiCloud API Testing Script" - echo "Usage: $0 [options]" - echo "Options:" - echo " -h, --help Show this help" - echo " --list List files in a folder (use --folder or root if not specified)" - echo " --upload Upload a file (requires --file and optionally --folder)" - echo " --download Download a file (requires --id)" - echo " --file Path to file for upload" - echo " --folder Folder ID (for upload or list operations)" - echo " --id File ID for download operation" -} - -# Parse arguments -OPERATION="" -FILE_PATH="" -FOLDER_ID="" -FILE_ID="" - -while [[ $# -gt 0 ]]; do - case $1 in - -h|--help) - show_help - exit 0 - ;; - --list) - OPERATION="list" - shift - ;; - --upload) - OPERATION="upload" - shift - ;; - --download) - OPERATION="download" - shift - ;; - --file) - FILE_PATH="$2" - shift 2 - ;; - --folder) - FOLDER_ID="$2" - shift 2 - ;; - --id) - FILE_ID="$2" - shift 2 - ;; - *) - echo "Unknown option: $1" - show_help - exit 1 - ;; - esac -done - -# Validate arguments -if [[ -z "$OPERATION" ]]; then - echo "Error: No operation specified." - show_help - exit 1 -fi - -# Execute requested operation -case $OPERATION in - "list") - echo "Listing files..." - if [[ -n "$FOLDER_ID" ]]; then - echo "Folder ID: $FOLDER_ID" - curl -s "$SERVER_URL/api/files?folder_id=$FOLDER_ID" | jq . - else - echo "Root folder" - curl -s "$SERVER_URL/api/files" | jq . - fi - ;; - "upload") - if [[ -z "$FILE_PATH" ]]; then - echo "Error: File path required for upload." - exit 1 - fi - - if [[ ! -f "$FILE_PATH" ]]; then - echo "Error: File not found: $FILE_PATH" - exit 1 - fi - - echo "Uploading file: $FILE_PATH" - if [[ -n "$FOLDER_ID" ]]; then - echo "To folder: $FOLDER_ID" - curl -s -X POST \ - -F "file=@$FILE_PATH" \ - -F "folder_id=$FOLDER_ID" \ - "$SERVER_URL/api/files/upload" | jq . - else - echo "To root folder" - curl -s -X POST \ - -F "file=@$FILE_PATH" \ - "$SERVER_URL/api/files/upload" | jq . - fi - ;; - "download") - if [[ -z "$FILE_ID" ]]; then - echo "Error: File ID required for download." - exit 1 - fi - - echo "Downloading file: $FILE_ID" - FILENAME=$(basename "$FILE_ID") - curl -s -o "$FILENAME" "$SERVER_URL/api/files/$FILE_ID" - echo "Downloaded to: $FILENAME" - ;; -esac - -echo "Operation completed." \ No newline at end of file diff --git a/tests/test-auth-api.sh b/tests/test-auth-api.sh deleted file mode 100755 index 10e95e68..00000000 --- a/tests/test-auth-api.sh +++ /dev/null @@ -1,262 +0,0 @@ -#!/bin/bash -set -e - -# Colors for prettier output -GREEN='\033[0;32m' -RED='\033[0;31m' -BLUE='\033[0;34m' -NC='\033[0m' # No Color - -BASE_URL="http://localhost:8085/api/auth" -TOKEN_FILE=".auth_tokens.json" -USER_ID="" - -echo -e "${BLUE}=== OxiCloud Authentication Test Script ===${NC}" -echo -e "${BLUE}This script will test the authentication endpoints${NC}" -echo - -cleanup() { - echo -e "\n${BLUE}Cleaning up test files...${NC}" - rm -f "$TOKEN_FILE" - echo "Done." -} - -trap cleanup EXIT - -# Function to check if server is running -check_server() { - echo -e "${BLUE}Checking if OxiCloud server is running...${NC}" - if ! curl -s "http://localhost:8085/api/health" > /dev/null; then - echo -e "${RED}Error: Server is not running. Please start the server first with 'cargo run'${NC}" - exit 1 - fi - echo -e "${GREEN}Server is running!${NC}" -} - -# 1. Test registration -test_registration() { - echo -e "\n${BLUE}1. Testing user registration...${NC}" - - USERNAME="testuser" - EMAIL="test@example.com" - PASSWORD="Test123!" - - RESPONSE=$(curl -s -X POST "$BASE_URL/register" \ - -H "Content-Type: application/json" \ - -d "{\"username\":\"$USERNAME\",\"email\":\"$EMAIL\",\"password\":\"$PASSWORD\"}") - - # Check if registration was successful - if [[ "$RESPONSE" == *"userId"* ]]; then - echo -e "${GREEN}✓ Registration successful${NC}" - USER_ID=$(echo $RESPONSE | jq -r '.userId') - echo "User created with ID: $USER_ID" - else - echo -e "${RED}✗ Registration failed${NC}" - echo "$RESPONSE" - exit 1 - fi -} - -# 2. Test login -test_login() { - echo -e "\n${BLUE}2. Testing user login...${NC}" - - USERNAME="testuser" - PASSWORD="Test123!" - - RESPONSE=$(curl -s -X POST "$BASE_URL/login" \ - -H "Content-Type: application/json" \ - -d "{\"username\":\"$USERNAME\",\"password\":\"$PASSWORD\"}") - - # Check if login was successful - if [[ "$RESPONSE" == *"accessToken"* ]]; then - echo -e "${GREEN}✓ Login successful${NC}" - # Save tokens to file for future requests - echo "$RESPONSE" > "$TOKEN_FILE" - # Extract token for logging - ACCESS_TOKEN=$(echo "$RESPONSE" | jq -r '.accessToken') - echo "Access token: ${ACCESS_TOKEN:0:20}...${ACCESS_TOKEN: -10}" - else - echo -e "${RED}✗ Login failed${NC}" - echo "$RESPONSE" - exit 1 - fi -} - -# 3. Test getting current user -test_get_user() { - echo -e "\n${BLUE}3. Testing get current user...${NC}" - - if [ ! -f "$TOKEN_FILE" ]; then - echo -e "${RED}✗ No authentication token found. Login first.${NC}" - exit 1 - fi - - ACCESS_TOKEN=$(jq -r '.accessToken' "$TOKEN_FILE") - - RESPONSE=$(curl -s -X GET "$BASE_URL/me" \ - -H "Authorization: Bearer $ACCESS_TOKEN") - - # Check if getting user was successful - if [[ "$RESPONSE" == *"username"* ]]; then - echo -e "${GREEN}✓ Got user details successfully${NC}" - echo "Username: $(echo "$RESPONSE" | jq -r '.username')" - echo "Email: $(echo "$RESPONSE" | jq -r '.email')" - echo "Role: $(echo "$RESPONSE" | jq -r '.role')" - else - echo -e "${RED}✗ Getting user details failed${NC}" - echo "$RESPONSE" - exit 1 - fi -} - -# 4. Test token refresh -test_refresh_token() { - echo -e "\n${BLUE}4. Testing token refresh...${NC}" - - if [ ! -f "$TOKEN_FILE" ]; then - echo -e "${RED}✗ No authentication token found. Login first.${NC}" - exit 1 - fi - - REFRESH_TOKEN=$(jq -r '.refreshToken' "$TOKEN_FILE") - - RESPONSE=$(curl -s -X POST "$BASE_URL/refresh" \ - -H "Content-Type: application/json" \ - -d "{\"refreshToken\":\"$REFRESH_TOKEN\"}") - - # Check if refresh was successful - if [[ "$RESPONSE" == *"accessToken"* ]]; then - echo -e "${GREEN}✓ Token refresh successful${NC}" - # Update tokens - echo "$RESPONSE" > "$TOKEN_FILE" - ACCESS_TOKEN=$(echo "$RESPONSE" | jq -r '.accessToken') - echo "New access token: ${ACCESS_TOKEN:0:20}...${ACCESS_TOKEN: -10}" - else - echo -e "${RED}✗ Token refresh failed${NC}" - echo "$RESPONSE" - exit 1 - fi -} - -# 5. Test change password -test_change_password() { - echo -e "\n${BLUE}5. Testing password change...${NC}" - - if [ ! -f "$TOKEN_FILE" ]; then - echo -e "${RED}✗ No authentication token found. Login first.${NC}" - exit 1 - fi - - ACCESS_TOKEN=$(jq -r '.accessToken' "$TOKEN_FILE") - OLD_PASSWORD="Test123!" - NEW_PASSWORD="NewTest456!" - - RESPONSE=$(curl -s -X PUT "$BASE_URL/change-password" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $ACCESS_TOKEN" \ - -d "{\"oldPassword\":\"$OLD_PASSWORD\",\"newPassword\":\"$NEW_PASSWORD\"}") - - # Check response code - if [ -z "$RESPONSE" ]; then - echo -e "${GREEN}✓ Password changed successfully${NC}" - - # Test login with new password - echo -e "${BLUE} Testing login with new password...${NC}" - LOGIN_RESPONSE=$(curl -s -X POST "$BASE_URL/login" \ - -H "Content-Type: application/json" \ - -d "{\"username\":\"testuser\",\"password\":\"$NEW_PASSWORD\"}") - - if [[ "$LOGIN_RESPONSE" == *"accessToken"* ]]; then - echo -e "${GREEN} ✓ Login with new password successful${NC}" - echo "$LOGIN_RESPONSE" > "$TOKEN_FILE" - else - echo -e "${RED} ✗ Login with new password failed${NC}" - echo "$LOGIN_RESPONSE" - fi - else - echo -e "${RED}✗ Password change failed${NC}" - echo "$RESPONSE" - fi -} - -# 6. Test logout -test_logout() { - echo -e "\n${BLUE}6. Testing logout...${NC}" - - if [ ! -f "$TOKEN_FILE" ]; then - echo -e "${RED}✗ No authentication token found. Login first.${NC}" - exit 1 - fi - - ACCESS_TOKEN=$(jq -r '.accessToken' "$TOKEN_FILE") - REFRESH_TOKEN=$(jq -r '.refreshToken' "$TOKEN_FILE") - - RESPONSE=$(curl -s -X POST "$BASE_URL/logout" \ - -H "Authorization: Bearer $REFRESH_TOKEN") - - # Check response - if [ -z "$RESPONSE" ]; then - echo -e "${GREEN}✓ Logout successful${NC}" - - # Verify token is invalidated by trying to use it - echo -e "${BLUE} Verifying token invalidation...${NC}" - VERIFY_RESPONSE=$(curl -s -X GET "$BASE_URL/me" \ - -H "Authorization: Bearer $ACCESS_TOKEN") - - if [[ "$VERIFY_RESPONSE" == *"error"* ]]; then - echo -e "${GREEN} ✓ Token successfully invalidated${NC}" - else - echo -e "${RED} ✗ Token still valid after logout${NC}" - echo "$VERIFY_RESPONSE" - fi - else - echo -e "${RED}✗ Logout failed${NC}" - echo "$RESPONSE" - fi -} - -# 7. Test protected resource access -test_protected_resource() { - echo -e "\n${BLUE}7. Testing protected resource access...${NC}" - - # Login first to get a fresh token - USERNAME="testuser" - PASSWORD="NewTest456!" # Use the new password - - LOGIN_RESPONSE=$(curl -s -X POST "$BASE_URL/login" \ - -H "Content-Type: application/json" \ - -d "{\"username\":\"$USERNAME\",\"password\":\"$PASSWORD\"}") - - if [[ "$LOGIN_RESPONSE" == *"accessToken"* ]]; then - echo "$LOGIN_RESPONSE" > "$TOKEN_FILE" - ACCESS_TOKEN=$(jq -r '.accessToken' "$TOKEN_FILE") - - echo -e "${BLUE} Accessing a protected resource (folders list)...${NC}" - RESOURCE_RESPONSE=$(curl -s -X GET "http://localhost:8085/api/folders" \ - -H "Authorization: Bearer $ACCESS_TOKEN") - - if [[ "$RESOURCE_RESPONSE" != *"error"* ]]; then - echo -e "${GREEN} ✓ Successfully accessed protected resource${NC}" - else - echo -e "${RED} ✗ Failed to access protected resource${NC}" - echo "$RESOURCE_RESPONSE" - fi - else - echo -e "${RED}✗ Login for resource test failed${NC}" - echo "$LOGIN_RESPONSE" - fi -} - -# Main test execution -check_server -test_registration -test_login -test_get_user -test_refresh_token -test_change_password -test_logout -test_protected_resource - -echo -e "\n${GREEN}All authentication tests completed successfully!${NC}" -echo -e "${BLUE}Your authentication system appears to be working correctly.${NC}" \ No newline at end of file diff --git a/tests/test-auth-env.sh b/tests/test-auth-env.sh deleted file mode 100755 index 54ab262c..00000000 --- a/tests/test-auth-env.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# Environment variables for OxiCloud authentication testing -export OXICLOUD_ENABLE_AUTH=true -export OXICLOUD_JWT_SECRET="testing-secret-key-for-development-only" -export OXICLOUD_ACCESS_TOKEN_EXPIRY_SECS=3600 -export OXICLOUD_REFRESH_TOKEN_EXPIRY_SECS=86400 -export OXICLOUD_DB_CONNECTION_STRING="postgres://postgres:postgres@localhost/oxicloud" - -# Run with: source test-auth-env.sh && cargo run -echo "Authentication environment variables set. Run 'cargo run' to start OxiCloud with auth enabled." \ No newline at end of file diff --git a/tests/test-compile-trash.sh b/tests/test-compile-trash.sh deleted file mode 100755 index 1b75cf7f..00000000 --- a/tests/test-compile-trash.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -echo -e "${GREEN}=== OxiCloud Trash Feature Compilation Test ===${NC}" - -# Set working directory -cd /home/torrefacto/OxiCloud - -# 1. Check if storage and trash directories exist -echo -e "${YELLOW}Checking trash directories...${NC}" -./check-trash-dirs.sh - -# 2. Build the project to verify our changes -echo -e "\n${YELLOW}Building project to verify changes...${NC}" -cargo build - -if [ $? -ne 0 ]; then - echo -e "${RED}Build failed, please check the errors above${NC}" - exit 1 -fi - -echo -e "${GREEN}Build successful!${NC}" - -# 3. Run a simple test to verify that the trash feature works -echo -e "\n${YELLOW}Running trash feature test...${NC}" -RUST_LOG=debug cargo run & -SERVER_PID=$! - -# Wait for the server to start -echo -e "${YELLOW}Waiting for the server to start (5 seconds)...${NC}" -sleep 5 - -# Run our debug script -echo -e "${YELLOW}Running trash debug script...${NC}" -python3 debug-trash.py - -# Shutdown the server -echo -e "${YELLOW}Shutting down the server...${NC}" -kill $SERVER_PID -wait $SERVER_PID 2>/dev/null - -echo -e "${GREEN}Test completed!${NC}" \ No newline at end of file diff --git a/tests/test-create-folder.sh b/tests/test-create-folder.sh deleted file mode 100755 index e26e902b..00000000 --- a/tests/test-create-folder.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# Define JSON data (respetando el formato exacto) -JSON_DATA='{"name":"test_api_folder_new","parent_id":null}' -CONTENT_LENGTH=$(echo -n "$JSON_DATA" | wc -c) - -# Crear carpeta mediante API -echo "Creando carpeta 'test_api_folder_new'..." -(echo -e "POST /api/folders HTTP/1.1\r -Host: localhost\r -Content-Type: application/json\r -Content-Length: $CONTENT_LENGTH\r -Connection: close\r -\r -$JSON_DATA" | nc localhost 8085) > /tmp/folder_response.txt - -cat /tmp/folder_response.txt -echo "" - -# Verificar si la carpeta se creó -sleep 1 -echo "Verificando directorio..." -ls -la /home/torrefacto/OxiCloud/storage/ \ No newline at end of file diff --git a/tests/test-delete-file.py b/tests/test-delete-file.py deleted file mode 100755 index 821dbc06..00000000 --- a/tests/test-delete-file.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 -import requests -import json -import os -import time - -# Configuration -BASE_URL = "http://localhost:8086/api" -DEFAULT_USER_ID = "00000000-0000-0000-0000-000000000000" - -# Create a test file and get its ID -def create_test_file(): - # Create temp file - filename = f"test-file-{int(time.time())}.txt" - with open(filename, 'w') as f: - f.write(f"Test content {time.time()}") - - # Upload file - files = {'file': open(filename, 'rb')} - response = requests.post(f"{BASE_URL}/files/upload?userId={DEFAULT_USER_ID}", files=files) - - # Clean up - os.remove(filename) - - if response.status_code in [200, 201, 202]: - data = response.json() - file_id = data.get('id') - print(f"Created file with ID: {file_id}") - return file_id - else: - print(f"Failed to create test file: {response.status_code} - {response.text}") - return None - -# Delete the file -def delete_file(file_id): - print(f"Deleting file with ID: {file_id}") - - # Delete the file - response = requests.delete(f"{BASE_URL}/files/{file_id}?userId={DEFAULT_USER_ID}") - - if response.status_code in [200, 201, 202, 204]: - print(f"File deleted successfully with status code: {response.status_code}") - return True - else: - print(f"Failed to delete file: {response.status_code} - {response.text}") - return False - -# List items in trash -def list_trash(): - print("Listing trash items...") - - response = requests.get(f"{BASE_URL}/trash?userId={DEFAULT_USER_ID}") - - if response.status_code in [200, 201]: - items = response.json() - print(f"Found {len(items)} items in trash:") - for item in items: - print(f"- {item['id']} ({item['item_type']}): {item['name']} (original ID: {item['original_id']})") - return items - else: - print(f"Failed to list trash: {response.status_code} - {response.text}") - return [] - -def main(): - # Create a test file - file_id = create_test_file() - if not file_id: - print("Could not create test file") - return - - # Delete the file - if not delete_file(file_id): - print("Could not delete file") - return - - # Wait for trash operation to complete - print("Waiting 2 seconds for trash operation to complete...") - time.sleep(2) - - # List trash items - trash_items = list_trash() - - # Check if file is in trash - file_in_trash = next((item for item in trash_items if item['original_id'] == file_id), None) - - if file_in_trash: - print(f"File found in trash with trash ID: {file_in_trash['id']}") - else: - print(f"File not found in trash! Debug the trash implementation.") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/tests/test-folder-simple.sh b/tests/test-folder-simple.sh deleted file mode 100755 index 398b4dbc..00000000 --- a/tests/test-folder-simple.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Crear la carpeta directamente -echo "Creando carpeta de prueba directamente..." -mkdir -p /home/torrefacto/OxiCloud/storage/prueba123 - -# Verificar las carpetas -echo "Verificando carpetas existentes..." -ls -la /home/torrefacto/OxiCloud/storage/ - -# Reiniciar el servidor -echo "Reiniciando el servidor..." -pkill -9 -f "oxicloud" -sleep 2 -cd /home/torrefacto/OxiCloud && cargo run > /tmp/oxicloud.log 2>&1 & -sleep 3 - -# Comprobación de interfaz web -echo "Reinicio completado. Intenta ahora en tu navegador crear una carpeta y ver si aparece." \ No newline at end of file diff --git a/tests/test-folder.js b/tests/test-folder.js deleted file mode 100644 index 40589e51..00000000 --- a/tests/test-folder.js +++ /dev/null @@ -1,48 +0,0 @@ -// Función para crear carpeta -async function createFolder() { - try { - const response = await fetch('http://localhost:8085/api/folders', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - name: 'test_folder_js', - parent_id: null - }) - }); - - const data = await response.json(); - console.log('Respuesta de creación de carpeta:', data); - - return data; - } catch (error) { - console.error('Error al crear carpeta:', error); - return null; - } -} - -// Función para listar carpetas -async function listFolders() { - try { - const response = await fetch('http://localhost:8085/api/folders'); - const data = await response.json(); - console.log('Listado de carpetas:', data); - - return data; - } catch (error) { - console.error('Error al listar carpetas:', error); - return []; - } -} - -// Ejecutar las funciones -async function runTest() { - console.log('Creando carpeta nueva...'); - await createFolder(); - - console.log('Listando carpetas...'); - await listFolders(); -} - -runTest(); \ No newline at end of file diff --git a/tests/test-folder.sh b/tests/test-folder.sh deleted file mode 100755 index 00acf901..00000000 --- a/tests/test-folder.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# Crear una carpeta nueva -echo "Creando carpeta nueva..." -curl -v -X POST -H "Content-Type: application/json" -d '{"name":"test_folder_script","parent_id":null}' http://localhost:8085/api/folders - -# Listar las carpetas -echo -e "\nListando carpetas..." -curl -v http://localhost:8085/api/folders \ No newline at end of file diff --git a/tests/test-trash-api-simple.py b/tests/test-trash-api-simple.py deleted file mode 100755 index ee6afdb4..00000000 --- a/tests/test-trash-api-simple.py +++ /dev/null @@ -1,181 +0,0 @@ -#!/usr/bin/env python3 -import requests -import json -import os -import time -import random -import string - -# Configuration -BASE_URL = "http://localhost:8086/api" -DEFAULT_USER_ID = "00000000-0000-0000-0000-000000000000" - -def create_test_file(): - """Create a test file and upload it""" - print("Creating test file...") - - # Create temp file - filename = f"test-file-{int(time.time())}.txt" - with open(filename, 'w') as f: - f.write(f"Test content {time.time()}") - - # Upload file - files = {'file': open(filename, 'rb')} - response = requests.post(f"{BASE_URL}/files/upload?userId={DEFAULT_USER_ID}", files=files) - - # Clean up - os.remove(filename) - - if response.status_code in [200, 201]: - # The response is already a file object with ID - data = response.json() - file_id = data.get('id') - print(f"Created file with ID: {file_id}") - return file_id - else: - print(f"Failed to create test file: {response.status_code} - {response.text}") - return None - -def create_test_folder(): - """Create a test folder""" - print("Creating test folder...") - - folder_name = f"test-folder-{int(time.time())}" - payload = { - "name": folder_name - } - - response = requests.post(f"{BASE_URL}/folders?userId={DEFAULT_USER_ID}", json=payload) - - if response.status_code in [200, 201]: - # The response is a folder object with ID - data = response.json() - folder_id = data.get('id') - print(f"Created folder with ID: {folder_id}") - return folder_id - else: - print(f"Failed to create test folder: {response.status_code} - {response.text}") - return None - -def move_to_trash(item_id, item_type): - """Move an item to trash""" - print(f"Moving {item_type} {item_id} to trash...") - - if item_type == 'file': - url = f"{BASE_URL}/files/{item_id}?userId={DEFAULT_USER_ID}" - else: - url = f"{BASE_URL}/folders/{item_id}?userId={DEFAULT_USER_ID}" - - response = requests.delete(url) - - if response.status_code in [200, 201, 202, 204]: - print(f"Successfully moved {item_type} to trash") - return True - else: - print(f"Failed to move {item_type} to trash: {response.status_code} - {response.text}") - return False - -def list_trash(): - """List all items in trash""" - print("Listing trash items...") - - response = requests.get(f"{BASE_URL}/trash?userId={DEFAULT_USER_ID}") - - if response.status_code in [200, 201]: - items = response.json() - print(f"Found {len(items)} items in trash:") - for item in items: - print(f"- {item['id']} ({item['item_type']}): {item['name']} (original ID: {item['original_id']})") - return items - else: - print(f"Failed to list trash: {response.status_code} - {response.text}") - return [] - -def restore_from_trash(trash_id): - """Restore an item from trash""" - print(f"Restoring item {trash_id} from trash...") - - response = requests.post(f"{BASE_URL}/trash/{trash_id}/restore?userId={DEFAULT_USER_ID}", json={}) - - if response.status_code in [200, 201, 202, 204]: - print("Successfully restored item from trash") - return True - else: - print(f"Failed to restore item: {response.status_code} - {response.text}") - return False - -def delete_permanently(trash_id): - """Delete an item permanently""" - print(f"Permanently deleting item {trash_id}...") - - response = requests.delete(f"{BASE_URL}/trash/{trash_id}?userId={DEFAULT_USER_ID}") - - if response.status_code in [200, 201, 202, 204]: - print("Successfully deleted item permanently") - return True - else: - print(f"Failed to delete item: {response.status_code} - {response.text}") - return False - -def main(): - """Main test function""" - print("=== Starting Trash API Tests ===") - - # Create test file - file_id = create_test_file() - if not file_id: - print("Test failed: Could not create test file") - return - - # Move file to trash - if not move_to_trash(file_id, 'file'): - print("Test failed: Could not move file to trash") - return - - # Wait a moment for the trash operation to complete - print("Waiting 5 seconds for trash operation to complete...") - time.sleep(5) - - # List trash items - trash_items = list_trash() - - # Find our file in trash - file_trash_item = next((item for item in trash_items if item['original_id'] == file_id and item['item_type'] == 'file'), None) - if not file_trash_item: - print("Test failed: File not found in trash") - return - - # Restore file from trash - if not restore_from_trash(file_trash_item['id']): - print("Test failed: Could not restore file from trash") - return - - # Create test folder - folder_id = create_test_folder() - if not folder_id: - print("Test failed: Could not create test folder") - return - - # Move folder to trash - if not move_to_trash(folder_id, 'folder'): - print("Test failed: Could not move folder to trash") - return - - # List trash items again - trash_items = list_trash() - - # Find our folder in trash - folder_trash_item = next((item for item in trash_items if item['original_id'] == folder_id and item['item_type'] == 'folder'), None) - if not folder_trash_item: - print("Test failed: Folder not found in trash") - return - - # Delete folder permanently - if not delete_permanently(folder_trash_item['id']): - print("Test failed: Could not delete folder permanently") - return - - print("=== All Trash API Tests Passed! ===") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/tests/test-trash-api.py b/tests/test-trash-api.py deleted file mode 100755 index 62f639d8..00000000 --- a/tests/test-trash-api.py +++ /dev/null @@ -1,325 +0,0 @@ -#!/usr/bin/env python3 -import requests -import json -import time -import uuid -import sys -import os - -# Configuration -BASE_URL = "http://localhost:8085/api" -DEBUG = True - -# Functions for testing -def log(message): - if DEBUG: - print(f"[DEBUG] {message}") - -def get_auth_token(): - """Get authentication token for testing""" - auth_url = f"{BASE_URL}/auth/login" - payload = { - "username": "test", - "password": "test123" - } - - response = requests.post(auth_url, json=payload) - if response.status_code != 200: - print(f"Failed to get auth token: {response.text}") - sys.exit(1) - - return response.json()["token"] - -def create_test_file(token, folder_id=None): - """Create a test file and return its ID""" - url = f"{BASE_URL}/files/upload" - - headers = { - "Authorization": f"Bearer {token}" - } - - # Generate unique filename - filename = f"test-file-{uuid.uuid4()}.txt" - - # Create test file content - file_content = f"This is a test file content for trash testing: {uuid.uuid4()}" - - files = { - 'file': (filename, file_content.encode(), 'text/plain') - } - - data = {} - if folder_id: - data['folder_id'] = folder_id - - response = requests.post(url, headers=headers, files=files, data=data) - - if response.status_code != 201: - print(f"Failed to create test file: {response.text}") - return None - - log(f"Created test file: {response.json()}") - return response.json()["id"] - -def create_test_folder(token, parent_id=None): - """Create a test folder and return its ID""" - url = f"{BASE_URL}/folders" - - headers = { - "Authorization": f"Bearer {token}", - "Content-Type": "application/json" - } - - # Generate unique folder name - folder_name = f"test-folder-{uuid.uuid4()}" - - payload = { - "name": folder_name - } - - if parent_id: - payload["parent_id"] = parent_id - - response = requests.post(url, headers=headers, json=payload) - - if response.status_code != 201: - print(f"Failed to create test folder: {response.text}") - return None - - log(f"Created test folder: {response.json()}") - return response.json()["id"] - -def move_file_to_trash(token, file_id): - """Move a file to trash""" - url = f"{BASE_URL}/files/trash/{file_id}" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.delete(url, headers=headers) - log(f"Move file to trash response: {response.status_code} - {response.text}") - - return response.status_code == 200 - -def move_folder_to_trash(token, folder_id): - """Move a folder to trash""" - url = f"{BASE_URL}/folders/trash/{folder_id}" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.delete(url, headers=headers) - log(f"Move folder to trash response: {response.status_code} - {response.text}") - - return response.status_code == 200 - -def list_trash_items(token): - """List all items in trash""" - url = f"{BASE_URL}/trash" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.get(url, headers=headers) - log(f"List trash items response: {response.status_code}") - - if response.status_code != 200: - print(f"Failed to list trash items: {response.text}") - return [] - - items = response.json() - log(f"Trash items: {items}") - return items - -def restore_from_trash(token, trash_id): - """Restore an item from trash""" - url = f"{BASE_URL}/trash/{trash_id}/restore" - - headers = { - "Authorization": f"Bearer {token}", - "Content-Type": "application/json" - } - - response = requests.post(url, headers=headers, json={}) - log(f"Restore from trash response: {response.status_code} - {response.text}") - - return response.status_code == 200 - -def delete_permanently(token, trash_id): - """Delete an item permanently from trash""" - url = f"{BASE_URL}/trash/{trash_id}" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.delete(url, headers=headers) - log(f"Delete permanently response: {response.status_code} - {response.text}") - - return response.status_code == 200 - -def empty_trash(token): - """Empty the trash (delete all items)""" - url = f"{BASE_URL}/trash/empty" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.delete(url, headers=headers) - log(f"Empty trash response: {response.status_code} - {response.text}") - - return response.status_code == 200 - -def check_file_exists(token, file_id): - """Check if a file exists""" - url = f"{BASE_URL}/files/{file_id}" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.get(url, headers=headers) - exists = response.status_code == 200 - log(f"File {file_id} exists: {exists}") - return exists - -def check_folder_exists(token, folder_id): - """Check if a folder exists""" - url = f"{BASE_URL}/folders/{folder_id}" - - headers = { - "Authorization": f"Bearer {token}" - } - - response = requests.get(url, headers=headers) - exists = response.status_code == 200 - log(f"Folder {folder_id} exists: {exists}") - return exists - -def run_tests(): - print("=== Starting Trash API Tests ===") - - # Get auth token - token = get_auth_token() - print(f"Auth token: {token[:10]}...") - - # Test 1: Create a file and move it to trash - print("\n=== Test 1: File to Trash ===") - file_id = create_test_file(token) - assert file_id, "Failed to create test file" - print(f"Created test file with ID: {file_id}") - - # Check file exists before trashing - assert check_file_exists(token, file_id), "File should exist before moving to trash" - - # Move file to trash - assert move_file_to_trash(token, file_id), "Failed to move file to trash" - print("Moved file to trash successfully") - - # Verify file is no longer accessible in main interface - assert not check_file_exists(token, file_id), "File should not be accessible after moving to trash" - - # Verify file appears in trash - trash_items = list_trash_items(token) - file_in_trash = any(item["original_id"] == file_id and item["item_type"] == "file" for item in trash_items) - assert file_in_trash, "File should appear in trash listing" - print("File correctly appears in trash") - - # Get the trash item ID - file_trash_id = next(item["id"] for item in trash_items if item["original_id"] == file_id) - - # Test 2: Create a folder and move it to trash - print("\n=== Test 2: Folder to Trash ===") - folder_id = create_test_folder(token) - assert folder_id, "Failed to create test folder" - print(f"Created test folder with ID: {folder_id}") - - # Check folder exists before trashing - assert check_folder_exists(token, folder_id), "Folder should exist before moving to trash" - - # Move folder to trash - assert move_folder_to_trash(token, folder_id), "Failed to move folder to trash" - print("Moved folder to trash successfully") - - # Verify folder is no longer accessible - assert not check_folder_exists(token, folder_id), "Folder should not be accessible after moving to trash" - - # Verify folder appears in trash - trash_items = list_trash_items(token) - folder_in_trash = any(item["original_id"] == folder_id and item["item_type"] == "folder" for item in trash_items) - assert folder_in_trash, "Folder should appear in trash listing" - print("Folder correctly appears in trash") - - # Get the trash item ID - folder_trash_id = next(item["id"] for item in trash_items if item["original_id"] == folder_id) - - # Test 3: Restore file from trash - print("\n=== Test 3: Restore File from Trash ===") - assert restore_from_trash(token, file_trash_id), "Failed to restore file from trash" - print("Restored file from trash successfully") - - # Verify file is now accessible again - assert check_file_exists(token, file_id), "File should be accessible after restoring from trash" - - # Verify file no longer appears in trash - trash_items = list_trash_items(token) - file_in_trash = any(item["id"] == file_trash_id for item in trash_items) - assert not file_in_trash, "File should not appear in trash after restoration" - print("File no longer appears in trash") - - # Test 4: Permanently delete folder from trash - print("\n=== Test 4: Permanently Delete Folder from Trash ===") - assert delete_permanently(token, folder_trash_id), "Failed to permanently delete folder" - print("Permanently deleted folder successfully") - - # Verify folder is still not accessible - assert not check_folder_exists(token, folder_id), "Folder should not be accessible after permanent deletion" - - # Verify folder no longer appears in trash - trash_items = list_trash_items(token) - folder_in_trash = any(item["id"] == folder_trash_id for item in trash_items) - assert not folder_in_trash, "Folder should not appear in trash after permanent deletion" - print("Folder no longer appears in trash") - - # Test 5: Test Empty Trash functionality - print("\n=== Test 5: Empty Trash ===") - - # Create multiple files and folders and move them to trash - print("Creating multiple test items...") - test_files = [create_test_file(token) for _ in range(3)] - test_folders = [create_test_folder(token) for _ in range(2)] - - # Move all to trash - for file_id in test_files: - move_file_to_trash(token, file_id) - - for folder_id in test_folders: - move_folder_to_trash(token, folder_id) - - # Verify items are in trash - trash_items = list_trash_items(token) - assert len(trash_items) >= 5, "All test items should be in trash" - print(f"Trash contains {len(trash_items)} items") - - # Empty trash - assert empty_trash(token), "Failed to empty trash" - print("Emptied trash successfully") - - # Verify trash is empty - trash_items = list_trash_items(token) - assert len(trash_items) == 0, "Trash should be empty" - print("Trash is empty as expected") - - print("\n=== All Trash API Tests Passed! ===") - return True - -if __name__ == "__main__": - try: - run_tests() - except Exception as e: - print(f"Test failed: {e}") - sys.exit(1) \ No newline at end of file diff --git a/tests/test-trash-api.sh b/tests/test-trash-api.sh deleted file mode 100755 index 7e08e6ca..00000000 --- a/tests/test-trash-api.sh +++ /dev/null @@ -1,416 +0,0 @@ -#!/bin/bash - -# Configuration -BASE_URL="http://localhost:8085/api" -AUTH_TOKEN="" - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -# Get auth token -get_auth_token() { - echo -e "${YELLOW}Getting auth token...${NC}" - - response=$(curl -s -X POST "$BASE_URL/auth/login" \ - -H "Content-Type: application/json" \ - -d '{"username":"test","password":"test123"}') - - AUTH_TOKEN=$(echo "$response" | grep -o '"token":"[^"]*' | cut -d'"' -f4) - - if [ -z "$AUTH_TOKEN" ]; then - echo -e "${RED}Failed to get auth token${NC}" - exit 1 - else - echo -e "${GREEN}Auth token: ${AUTH_TOKEN:0:10}...${NC}" - fi -} - -# Create a test file -create_test_file() { - echo -e "${YELLOW}Creating test file...${NC}" - - local content="Test file content $(date)" - local filename="test-file-$(date +%s).txt" - - echo "$content" > "$filename" - - response=$(curl -s -X POST "$BASE_URL/files/upload" \ - -H "Authorization: Bearer $AUTH_TOKEN" \ - -F "file=@$filename") - - file_id=$(echo "$response" | grep -o '"id":"[^"]*' | cut -d'"' -f4) - - rm "$filename" - - if [ -z "$file_id" ]; then - echo -e "${RED}Failed to create test file${NC}" - return 1 - else - echo -e "${GREEN}Created file with ID: $file_id${NC}" - echo "$file_id" - return 0 - fi -} - -# Create a test folder -create_test_folder() { - echo -e "${YELLOW}Creating test folder...${NC}" - - local folder_name="test-folder-$(date +%s)" - - response=$(curl -s -X POST "$BASE_URL/folders" \ - -H "Authorization: Bearer $AUTH_TOKEN" \ - -H "Content-Type: application/json" \ - -d "{\"name\":\"$folder_name\"}") - - folder_id=$(echo "$response" | grep -o '"id":"[^"]*' | cut -d'"' -f4) - - if [ -z "$folder_id" ]; then - echo -e "${RED}Failed to create test folder${NC}" - return 1 - else - echo -e "${GREEN}Created folder with ID: $folder_id${NC}" - echo "$folder_id" - return 0 - fi -} - -# Move a file to trash -move_file_to_trash() { - local file_id=$1 - echo -e "${YELLOW}Moving file $file_id to trash...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/files/trash/$file_id" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully moved file to trash${NC}" - return 0 - else - echo -e "${RED}Failed to move file to trash: $response${NC}" - return 1 - fi -} - -# Move a folder to trash -move_folder_to_trash() { - local folder_id=$1 - echo -e "${YELLOW}Moving folder $folder_id to trash...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/folders/trash/$folder_id" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully moved folder to trash${NC}" - return 0 - else - echo -e "${RED}Failed to move folder to trash: $response${NC}" - return 1 - fi -} - -# List trash items -list_trash_items() { - echo -e "${YELLOW}Listing trash items...${NC}" - - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - echo "$response" | jq - return 0 -} - -# Restore an item from trash -restore_from_trash() { - local trash_id=$1 - echo -e "${YELLOW}Restoring item $trash_id from trash...${NC}" - - response=$(curl -s -X POST "$BASE_URL/trash/$trash_id/restore" \ - -H "Authorization: Bearer $AUTH_TOKEN" \ - -H "Content-Type: application/json" \ - -d "{}") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully restored item from trash${NC}" - return 0 - else - echo -e "${RED}Failed to restore item from trash: $response${NC}" - return 1 - fi -} - -# Delete an item permanently -delete_permanently() { - local trash_id=$1 - echo -e "${YELLOW}Permanently deleting item $trash_id...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/trash/$trash_id" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully deleted item permanently${NC}" - return 0 - else - echo -e "${RED}Failed to delete item permanently: $response${NC}" - return 1 - fi -} - -# Empty the trash -empty_trash() { - echo -e "${YELLOW}Emptying trash...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/trash/empty" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully emptied trash${NC}" - return 0 - else - echo -e "${RED}Failed to empty trash: $response${NC}" - return 1 - fi -} - -# Check if a file exists -check_file_exists() { - local file_id=$1 - echo -e "${YELLOW}Checking if file $file_id exists...${NC}" - - response=$(curl -s -o /dev/null -w "%{http_code}" -X GET "$BASE_URL/files/$file_id" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if [ "$response" == "200" ]; then - echo -e "${GREEN}File exists${NC}" - return 0 - else - echo -e "${RED}File does not exist (HTTP $response)${NC}" - return 1 - fi -} - -# Check if a folder exists -check_folder_exists() { - local folder_id=$1 - echo -e "${YELLOW}Checking if folder $folder_id exists...${NC}" - - response=$(curl -s -o /dev/null -w "%{http_code}" -X GET "$BASE_URL/folders/$folder_id" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - if [ "$response" == "200" ]; then - echo -e "${GREEN}Folder exists${NC}" - return 0 - else - echo -e "${RED}Folder does not exist (HTTP $response)${NC}" - return 1 - fi -} - -# Run tests -run_tests() { - echo -e "${GREEN}=== Starting Trash API Tests ===${NC}" - - # Get auth token - get_auth_token - - # Test 1: Create a file and move it to trash - echo -e "${GREEN}\n=== Test 1: File to Trash ===${NC}" - file_id=$(create_test_file) - if [ $? -ne 0 ]; then - echo -e "${RED}Test 1 failed: Could not create test file${NC}" - exit 1 - fi - - # Check file exists before trashing - check_file_exists "$file_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 1 failed: File should exist before moving to trash${NC}" - exit 1 - fi - - # Move file to trash - move_file_to_trash "$file_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 1 failed: Could not move file to trash${NC}" - exit 1 - fi - - # Verify file is no longer accessible in main interface - check_file_exists "$file_id" - if [ $? -eq 0 ]; then - echo -e "${RED}Test 1 failed: File should not be accessible after moving to trash${NC}" - exit 1 - else - echo -e "${GREEN}File correctly inaccessible after moving to trash${NC}" - fi - - # Verify file appears in trash - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - file_trash_id=$(echo "$response" | jq -r ".[] | select(.original_id == \"$file_id\" and .item_type == \"file\") | .id") - - if [ -z "$file_trash_id" ]; then - echo -e "${RED}Test 1 failed: File should appear in trash listing${NC}" - exit 1 - else - echo -e "${GREEN}File correctly appears in trash with trash ID: $file_trash_id${NC}" - fi - - # Test 2: Create a folder and move it to trash - echo -e "${GREEN}\n=== Test 2: Folder to Trash ===${NC}" - folder_id=$(create_test_folder) - if [ $? -ne 0 ]; then - echo -e "${RED}Test 2 failed: Could not create test folder${NC}" - exit 1 - fi - - # Check folder exists before trashing - check_folder_exists "$folder_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 2 failed: Folder should exist before moving to trash${NC}" - exit 1 - fi - - # Move folder to trash - move_folder_to_trash "$folder_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 2 failed: Could not move folder to trash${NC}" - exit 1 - fi - - # Verify folder is no longer accessible - check_folder_exists "$folder_id" - if [ $? -eq 0 ]; then - echo -e "${RED}Test 2 failed: Folder should not be accessible after moving to trash${NC}" - exit 1 - else - echo -e "${GREEN}Folder correctly inaccessible after moving to trash${NC}" - fi - - # Verify folder appears in trash - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - folder_trash_id=$(echo "$response" | jq -r ".[] | select(.original_id == \"$folder_id\" and .item_type == \"folder\") | .id") - - if [ -z "$folder_trash_id" ]; then - echo -e "${RED}Test 2 failed: Folder should appear in trash listing${NC}" - exit 1 - else - echo -e "${GREEN}Folder correctly appears in trash with trash ID: $folder_trash_id${NC}" - fi - - # Test 3: Restore file from trash - echo -e "${GREEN}\n=== Test 3: Restore File from Trash ===${NC}" - restore_from_trash "$file_trash_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 3 failed: Could not restore file from trash${NC}" - exit 1 - fi - - # Verify file is now accessible again - check_file_exists "$file_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 3 failed: File should be accessible after restoring from trash${NC}" - exit 1 - fi - - # Verify file no longer appears in trash - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - file_still_in_trash=$(echo "$response" | jq -r ".[] | select(.id == \"$file_trash_id\") | .id") - - if [ ! -z "$file_still_in_trash" ]; then - echo -e "${RED}Test 3 failed: File should not appear in trash after restoration${NC}" - exit 1 - else - echo -e "${GREEN}File no longer appears in trash${NC}" - fi - - # Test 4: Permanently delete folder from trash - echo -e "${GREEN}\n=== Test 4: Permanently Delete Folder from Trash ===${NC}" - delete_permanently "$folder_trash_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test 4 failed: Could not permanently delete folder${NC}" - exit 1 - fi - - # Verify folder is still not accessible - check_folder_exists "$folder_id" - if [ $? -eq 0 ]; then - echo -e "${RED}Test 4 failed: Folder should not be accessible after permanent deletion${NC}" - exit 1 - fi - - # Verify folder no longer appears in trash - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - folder_still_in_trash=$(echo "$response" | jq -r ".[] | select(.id == \"$folder_trash_id\") | .id") - - if [ ! -z "$folder_still_in_trash" ]; then - echo -e "${RED}Test 4 failed: Folder should not appear in trash after permanent deletion${NC}" - exit 1 - else - echo -e "${GREEN}Folder no longer appears in trash${NC}" - fi - - # Test 5: Test Empty Trash functionality - echo -e "${GREEN}\n=== Test 5: Empty Trash ===${NC}" - - # Create multiple files and folders and move them to trash - echo -e "${YELLOW}Creating multiple test items...${NC}" - file_ids=() - folder_ids=() - - for i in {1..3}; do - file_id=$(create_test_file) - file_ids+=("$file_id") - move_file_to_trash "$file_id" - done - - for i in {1..2}; do - folder_id=$(create_test_folder) - folder_ids+=("$folder_id") - move_folder_to_trash "$folder_id" - done - - # Verify items are in trash - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - trash_count=$(echo "$response" | jq '. | length') - echo -e "${GREEN}Trash contains $trash_count items${NC}" - - # Empty trash - empty_trash - if [ $? -ne 0 ]; then - echo -e "${RED}Test 5 failed: Could not empty trash${NC}" - exit 1 - fi - - # Verify trash is empty - response=$(curl -s -X GET "$BASE_URL/trash" \ - -H "Authorization: Bearer $AUTH_TOKEN") - - trash_count=$(echo "$response" | jq '. | length') - - if [ "$trash_count" -ne 0 ]; then - echo -e "${RED}Test 5 failed: Trash should be empty, but contains $trash_count items${NC}" - exit 1 - else - echo -e "${GREEN}Trash is empty as expected${NC}" - fi - - echo -e "${GREEN}\n=== All Trash API Tests Passed! ===${NC}" - return 0 -} - -# Run the tests -run_tests -exit $? \ No newline at end of file diff --git a/tests/test-trash-simple.sh b/tests/test-trash-simple.sh deleted file mode 100755 index f72ae164..00000000 --- a/tests/test-trash-simple.sh +++ /dev/null @@ -1,152 +0,0 @@ -#!/bin/bash - -# Configuration -BASE_URL="http://localhost:8086/api" -USER_ID="00000000-0000-0000-0000-000000000000" - -# Colors for output -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -# Create a test file directly (no authentication) -create_test_file() { - echo -e "${YELLOW}Creating test file...${NC}" - - local content="Test file content $(date)" - local filename="test-file-$(date +%s).txt" - - echo "$content" > "$filename" - - response=$(curl -s -X POST "$BASE_URL/files/upload" \ - -F "file=@$filename" \ - -F "userId=$USER_ID") - - file_id=$(echo "$response" | grep -o '"id":"[^"]*' | cut -d'"' -f4) - - rm "$filename" - - if [ -z "$file_id" ]; then - echo -e "${RED}Failed to create test file${NC}" - return 1 - else - echo -e "${GREEN}Created file with ID: $file_id${NC}" - echo "$file_id" - return 0 - fi -} - -# Create a test folder -create_test_folder() { - echo -e "${YELLOW}Creating test folder...${NC}" - - local folder_name="test-folder-$(date +%s)" - - response=$(curl -s -X POST "$BASE_URL/folders" \ - -H "Content-Type: application/json" \ - -d "{\"name\":\"$folder_name\", \"userId\":\"$USER_ID\"}") - - folder_id=$(echo "$response" | grep -o '"id":"[^"]*' | cut -d'"' -f4) - - if [ -z "$folder_id" ]; then - echo -e "${RED}Failed to create test folder${NC}" - return 1 - else - echo -e "${GREEN}Created folder with ID: $folder_id${NC}" - echo "$folder_id" - return 0 - fi -} - -# Move a file to trash -move_file_to_trash() { - local file_id=$1 - echo -e "${YELLOW}Moving file $file_id to trash...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/files/trash/$file_id") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully moved file to trash${NC}" - return 0 - else - echo -e "${RED}Failed to move file to trash: $response${NC}" - return 1 - fi -} - -# Move a folder to trash -move_folder_to_trash() { - local folder_id=$1 - echo -e "${YELLOW}Moving folder $folder_id to trash...${NC}" - - response=$(curl -s -X DELETE "$BASE_URL/folders/trash/$folder_id") - - if echo "$response" | grep -q "success"; then - echo -e "${GREEN}Successfully moved folder to trash${NC}" - return 0 - else - echo -e "${RED}Failed to move folder to trash: $response${NC}" - return 1 - fi -} - -# List trash items -list_trash_items() { - echo -e "${YELLOW}Listing trash items...${NC}" - - response=$(curl -s -X GET "$BASE_URL/trash?userId=$USER_ID") - - echo "$response" - return 0 -} - -# Run simple trash test -run_test() { - echo -e "${GREEN}=== Starting Simple Trash Test ===${NC}" - - # Test: Create a file and move it to trash - echo -e "${GREEN}\n=== Test: File to Trash ===${NC}" - file_id=$(create_test_file) - if [ $? -ne 0 ]; then - echo -e "${RED}Test failed: Could not create test file${NC}" - exit 1 - fi - - # Move file to trash - move_file_to_trash "$file_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test failed: Could not move file to trash${NC}" - exit 1 - fi - - # List trash items to confirm - echo -e "${GREEN}Listing trash items after file deletion:${NC}" - list_trash_items - - # Test: Create a folder and move it to trash - echo -e "${GREEN}\n=== Test: Folder to Trash ===${NC}" - folder_id=$(create_test_folder) - if [ $? -ne 0 ]; then - echo -e "${RED}Test failed: Could not create test folder${NC}" - exit 1 - fi - - # Move folder to trash - move_folder_to_trash "$folder_id" - if [ $? -ne 0 ]; then - echo -e "${RED}Test failed: Could not move folder to trash${NC}" - exit 1 - fi - - # List trash items to confirm - echo -e "${GREEN}Listing trash items after folder deletion:${NC}" - list_trash_items - - echo -e "${GREEN}\n=== Test Completed ===${NC}" - return 0 -} - -# Run the test -run_test -exit $? \ No newline at end of file diff --git a/tests/test-trash.sh b/tests/test-trash.sh deleted file mode 100755 index 7edc7119..00000000 --- a/tests/test-trash.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -BASE_URL="http://127.0.0.1:8085/api" - -# Get the login token -echo "Logging in..." -TOKEN=$(curl -s -X POST "${BASE_URL}/auth/login" \ - -H "Content-Type: application/json" \ - -d '{"username":"admin", "password":"admin123"}' | jq -r '.access_token') - -if [ -z "$TOKEN" ] || [ "$TOKEN" == "null" ]; then - echo "Failed to get token" - exit 1 -fi - -echo "Token: ${TOKEN:0:15}..." - -# Create a test folder -echo -e "\nCreating test folder..." -FOLDER_ID=$(curl -s -X POST "${BASE_URL}/folders" \ - -H "Content-Type: application/json" \ - -H "Authorization: Bearer $TOKEN" \ - -d '{"name":"Trash Test Folder", "parent_id":null}' | jq -r '.id') - -echo "Created folder with ID: $FOLDER_ID" - -# Create a test file in the folder -echo -e "\nCreating test file..." -FILE_CONTENT="This is a test file that will be moved to trash." -TEST_FILE_PATH="/tmp/trash_test_file.txt" -echo "$FILE_CONTENT" > "$TEST_FILE_PATH" - -FILE_ID=$(curl -s -X POST "${BASE_URL}/files/upload" \ - -H "Authorization: Bearer $TOKEN" \ - -F "file=@$TEST_FILE_PATH" \ - -F "folder_id=$FOLDER_ID" | jq -r '.id') - -echo "Created file with ID: $FILE_ID" - -# Try the trash operations (these will use the frontend code we modified) -echo -e "\nTesting trash operations through the frontend using direct delete (which uses trash)..." -echo "Moving file to trash..." -curl -s -X DELETE "${BASE_URL}/files/$FILE_ID" \ - -H "Authorization: Bearer $TOKEN" - -# Check if file is still accessible (should return 404 if moved to trash) -echo -e "\nChecking if file is still accessible..." -STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${BASE_URL}/files/$FILE_ID" \ - -H "Authorization: Bearer $TOKEN") - -if [ "$STATUS" == "404" ]; then - echo "File moved to trash successfully (returns 404)" -else - echo "File still accessible, move to trash failed (status: $STATUS)" -fi - -echo -e "\nMoving folder to trash..." -curl -s -X DELETE "${BASE_URL}/folders/$FOLDER_ID" \ - -H "Authorization: Bearer $TOKEN" - -# Check if folder is still accessible -echo -e "\nChecking if folder is still accessible..." -STATUS=$(curl -s -o /dev/null -w "%{http_code}" "${BASE_URL}/folders/$FOLDER_ID" \ - -H "Authorization: Bearer $TOKEN") - -if [ "$STATUS" == "404" ]; then - echo "Folder moved to trash successfully (returns 404)" -else - echo "Folder still accessible, move to trash failed (status: $STATUS)" -fi - -echo -e "\nTest complete." \ No newline at end of file diff --git a/tests/test-upload.py b/tests/test-upload.py deleted file mode 100755 index ea7e6c5e..00000000 --- a/tests/test-upload.py +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env python3 -import requests -import argparse -import os -import json - -def upload_file(url, file_path, folder_id=None): - """Upload a file to the server""" - if not os.path.exists(file_path): - print(f"Error: File not found: {file_path}") - return - - # Create the multipart form data - files = {'file': open(file_path, 'rb')} - data = {} - - if folder_id: - data['folder_id'] = folder_id - - # Send the request - try: - response = requests.post(f"{url}/api/files/upload", files=files, data=data) - return response.json() - except Exception as e: - print(f"Error during upload: {e}") - return None - -def list_files(url, folder_id=None): - """List files in a folder""" - params = {} - if folder_id: - params['folder_id'] = folder_id - - try: - response = requests.get(f"{url}/api/files", params=params) - return response.json() - except Exception as e: - print(f"Error listing files: {e}") - return None - -def download_file(url, file_id, output_path=None): - """Download a file by its ID""" - try: - response = requests.get(f"{url}/api/files/{file_id}") - - if output_path is None: - output_path = file_id.split('/')[-1] # Use the last part of the path as filename - - # Save the file - with open(output_path, 'wb') as f: - f.write(response.content) - - return output_path - except Exception as e: - print(f"Error downloading file: {e}") - return None - -def main(): - parser = argparse.ArgumentParser(description='Test OxiCloud API') - parser.add_argument('--url', type=str, default="http://localhost:8086", help='Server URL') - parser.add_argument('--action', type=str, required=True, choices=['upload', 'list', 'download'], help='Action to perform') - parser.add_argument('--file', type=str, help='Path to file for upload or output path for download') - parser.add_argument('--folder', type=str, help='Folder ID for upload or list actions') - parser.add_argument('--id', type=str, help='File ID for download action') - - args = parser.parse_args() - - if args.action == 'upload': - if not args.file: - print("Error: --file is required for upload action") - return - - result = upload_file(args.url, args.file, args.folder) - if result: - if isinstance(result, dict): - print(json.dumps(result, indent=2)) - print(f"File uploaded successfully with ID: {result.get('id', 'unknown')}") - else: - print(json.dumps(result, indent=2)) - print("Received unexpected response format") - - elif args.action == 'list': - result = list_files(args.url, args.folder) - if result: - print(json.dumps(result, indent=2)) - print(f"Found {len(result)} files") - - elif args.action == 'download': - if not args.id: - print("Error: --id is required for download action") - return - - output_path = download_file(args.url, args.id, args.file) - if output_path: - print(f"File downloaded successfully to {output_path}") - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/tests/test-upload.sh b/tests/test-upload.sh deleted file mode 100755 index c5036d73..00000000 --- a/tests/test-upload.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -# Test file upload to the server -echo "Testing file upload to OxiCloud server..." - -# Build the form data -curl -X POST \ - -F "file=@test-upload.txt" \ - -F "folder_id=folder-storage:1" \ - http://localhost:8086/api/files/upload - -echo "" -echo "Upload test completed." \ No newline at end of file diff --git a/tests/test-upload.txt b/tests/test-upload.txt deleted file mode 100644 index 3f2d84e3..00000000 --- a/tests/test-upload.txt +++ /dev/null @@ -1 +0,0 @@ -This is a test file for upload