test_notifications.py 825 B

123456789101112131415161718192021
  1. import pytest
  2. from notifications import notify_status_change, EMAIL_TEMPLATES
  3. def test_notify_status_change_en():
  4. result = notify_status_change("test@example.com", 123, "shipped", "John", "en")
  5. assert result is True
  6. def test_notify_status_change_fallback():
  7. # Test fallback to 'en' for unknown language
  8. result = notify_status_change("test@example.com", 123, "shipped", "John", "fr")
  9. assert result is True
  10. def test_notify_status_change_ua():
  11. result = notify_status_change("test@example.com", 456, "processing", "Ivan", "ua")
  12. assert result is True
  13. def test_email_templates_completeness():
  14. for lang in ["en", "ru", "me", "ua"]:
  15. assert lang in EMAIL_TEMPLATES
  16. assert "status_change_subject" in EMAIL_TEMPLATES[lang]
  17. assert "status_change_body" in EMAIL_TEMPLATES[lang]