Skip to content

Latest commit

 

History

History
65 lines (46 loc) · 1.28 KB

File metadata and controls

65 lines (46 loc) · 1.28 KB

Tests for scale_email_sync

This directory contains tests for the scale_email_sync.py script.

Running Tests

Install test dependencies

pip install -r requirements-test.txt

Run all tests

pytest

Run with coverage

pytest --cov=scale_email_sync --cov-report=html

Run specific test file

pytest tests/test_scale_email_sync.py

Run specific test class or function

pytest tests/test_scale_email_sync.py::TestListMonk
pytest tests/test_scale_email_sync.py::TestListMonk::test_add_subscriber_new

Run with verbose output

pytest -v

Test Structure

  • test_scale_email_sync.py - Main test file containing:
    • TestLoadConfig - Tests for configuration loading
    • TestRegData - Tests for RegData class (CSV and database operations)
    • TestListMonk - Tests for ListMonk class (API interactions, synchronization)
    • TestIntegration - Integration tests for the full workflow

Coverage

The tests aim to cover:

  • Configuration file loading
  • CSV data parsing
  • Database data fetching
  • Listmonk API interactions (GET, POST, PUT)
  • Subscriber synchronization logic
  • List management (expected, missing, extra lists)
  • Dry-run mode
  • Stats tracking and Datadog reporting
  • Error handling