This directory contains tests for the scale_email_sync.py script.
pip install -r requirements-test.txtpytestpytest --cov=scale_email_sync --cov-report=htmlpytest tests/test_scale_email_sync.pypytest tests/test_scale_email_sync.py::TestListMonk
pytest tests/test_scale_email_sync.py::TestListMonk::test_add_subscriber_newpytest -vtest_scale_email_sync.py- Main test file containing:TestLoadConfig- Tests for configuration loadingTestRegData- Tests for RegData class (CSV and database operations)TestListMonk- Tests for ListMonk class (API interactions, synchronization)TestIntegration- Integration tests for the full workflow
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