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
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?