Refactor configuration handling and improve error management across services; normalize placeholder values for SMTP and Stripe configurations; enhance local storage fallback logic in StorageService; add tests for new behaviors and edge cases.

This commit is contained in:
Your Name
2026-03-26 14:15:10 +02:00
parent 688d411537
commit bc8a5dc290
19 changed files with 423 additions and 95 deletions

View File

@@ -0,0 +1,19 @@
"""Tests for SMTP configuration normalization."""
from app.services.email_service import send_email
def test_placeholder_smtp_host_is_treated_as_unconfigured(app, monkeypatch):
"""A copied sample SMTP host should not trigger a network call."""
with app.app_context():
app.config.update({
"SMTP_HOST": "smtp.your-provider.com",
"SMTP_PORT": 587,
"SMTP_USER": "noreply@dociva.io",
"SMTP_PASSWORD": "replace-with-smtp-password",
})
def fail_if_called(*args, **kwargs):
raise AssertionError("SMTP should not be contacted for placeholder config")
monkeypatch.setattr("smtplib.SMTP", fail_if_called)
assert send_email("user@example.com", "Subject", "<p>Body</p>") is False