feat: Add email settings management and templates functionality
- Implemented email settings configuration in the admin panel, allowing for SMTP settings and notification preferences. - Created a new template for email settings with fields for SMTP host, port, username, password, sender address, and recipients. - Added JavaScript functionality to handle loading, saving, and validating email settings. - Introduced email templates management, enabling the listing, editing, and saving of email templates. - Updated navigation to include links to email settings and templates. - Added tests for email settings and templates to ensure proper functionality and validation.
This commit is contained in:
@@ -28,3 +28,35 @@ def setup_tmp_db(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr("server.settings.ADMIN_PASSWORD", "admin")
|
||||
init_db()
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True, scope="function")
|
||||
def stub_smtp(monkeypatch):
|
||||
"""Replace smtplib SMTP clients with fast stubs to avoid real network calls."""
|
||||
|
||||
class _DummySMTP:
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.args = args
|
||||
self.kwargs = kwargs
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc, tb):
|
||||
return False
|
||||
|
||||
def starttls(self):
|
||||
return None
|
||||
|
||||
def login(self, *args, **kwargs):
|
||||
return None
|
||||
|
||||
def send_message(self, *args, **kwargs):
|
||||
return {}
|
||||
|
||||
def sendmail(self, *args, **kwargs):
|
||||
return {}
|
||||
|
||||
monkeypatch.setattr("smtplib.SMTP", _DummySMTP)
|
||||
monkeypatch.setattr("smtplib.SMTP_SSL", _DummySMTP)
|
||||
yield
|
||||
|
||||
Reference in New Issue
Block a user