You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when I run tests I get an error that the email template does not exist:
post_office.models.EmailTemplate.DoesNotExist: EmailTemplate matching query does not exist.
So the question is, is there some recommended way to mock email templates for tests? As an alternative, we can use the fixture to mock mail.send function altogether:
@pytest.fixture(scope="session", autouse=True)
def send_email_mock():
with mock.patch("post_office.mail.send", return_value=None) as _fixture:
yield _fixture
What is the recommended approach here?
The text was updated successfully, but these errors were encountered:
Hi,
When writing unit tests for our application, we use the following setup to prevent emails from being sent:
However, when I run tests I get an error that the email template does not exist:
So the question is, is there some recommended way to mock email templates for tests? As an alternative, we can use the fixture to mock
mail.send
function altogether:What is the recommended approach here?
The text was updated successfully, but these errors were encountered: