Files
whyrating-engine-legacy/tests
Alejandro Gutiérrez 544e028c3f Phase 0: Project restructure to ReviewIQ platform architecture
New structure:
- scrapers/google_reviews/v1_0_0.py (was modules/scraper_clean.py)
- scrapers/base.py (BaseScraper interface)
- scrapers/registry.py (ScraperRegistry for version routing)
- core/database.py, models.py, config.py, enums.py
- utils/logger.py, crash_analyzer.py, health_checks.py, helpers.py, date_converter.py
- workers/chrome_pool.py
- services/webhook_service.py
- api/ routes structure (empty, ready for Phase 2)
- tests/ structure mirroring source

All imports updated in:
- api_server_production.py (7 import paths updated)
- utils/health_checks.py (scraper import path)

Legacy modules moved to modules/_legacy/:
- data_storage.py, image_handler.py, s3_handler.py (unused)

Syntax verified, frontend build passing.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:22:08 +00:00
..
2025-06-03 00:12:11 +07:00
2025-06-03 00:12:11 +07:00
2025-06-03 00:12:11 +07:00

Tests

This directory contains pytest tests for the Google Reviews Scraper.

Running Tests

  1. Install dependencies:
pip install -r requirements.txt
  1. Run all tests:
pytest tests/
  1. Run specific test files:
pytest tests/test_mongodb_connection.py
pytest tests/test_s3_connection.py
  1. Run with verbose output:
pytest tests/ -v

Test Coverage

MongoDB Connection Tests (test_mongodb_connection.py)

  • Tests MongoDB connection when enabled in config
  • Validates MongoDB configuration parameters
  • Tests basic database operations (insert/find/delete)
  • Skips tests when MongoDB is disabled

S3 Connection Tests (test_s3_connection.py)

  • Tests S3 connection when enabled in config
  • Validates S3 configuration parameters
  • Tests file upload/download operations
  • Tests S3Handler class initialization
  • Skips tests when S3 is disabled

Configuration

Tests use the main config.yaml file in the project root. Make sure your configuration is properly set up:

  • For MongoDB tests: Ensure use_mongodb: true and valid MongoDB credentials
  • For S3 tests: Ensure use_s3: true and valid AWS credentials

Test Results

  • Tests will be skipped if the corresponding service (MongoDB/S3) is disabled in config
  • Failed connection tests indicate configuration or service availability issues
  • All tests should pass when services are properly configured and accessible