diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py index b6256e9cba..94ee453d81 100644 --- a/zerver/tests/test_docs.py +++ b/zerver/tests/test_docs.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import mock import os import subprocess @@ -78,7 +79,8 @@ class DocPageTest(ZulipTestCase): self._test('/errors/404/', 'Page not found') self._test('/errors/5xx/', 'Internal server error') - with self.settings(EMAIL_BACKEND='zproject.email_backends.EmailLogBackEnd'): + with self.settings(EMAIL_BACKEND='zproject.email_backends.EmailLogBackEnd'), \ + mock.patch('logging.info', return_value=None): # For reaching full coverage for clear_emails function result = self.client_get('/emails/clear/') self.assertEqual(result.status_code, 302) diff --git a/zproject/email_backends.py b/zproject/email_backends.py index f4711278c3..36e0fd9390 100644 --- a/zproject/email_backends.py +++ b/zproject/email_backends.py @@ -1,3 +1,5 @@ +import logging + from typing import List from django.conf import settings @@ -39,5 +41,5 @@ class EmailLogBackEnd(BaseEmailBackend): for email in email_messages: self.log_email(email) email_log_url = settings.ROOT_DOMAIN_URI + "/emails" - print("You can access all the emails sent in development environment by visiting ", email_log_url) + logging.info("Emails sent in development are available at ", email_log_url) return len(email_messages)