File: mail.py

package info (click to toggle)
python-pytest-djangoapp 1.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 396 kB
  • sloc: python: 1,116; makefile: 114; sh: 6
file content (23 lines) | stat: -rw-r--r-- 368 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from typing import List

import pytest

from django.core import mail


mail.outbox = []


@pytest.fixture()
def mail_outbox() -> List[mail.EmailMessage]:
    """Returns mail outbox: list of sent message objects.

    Example::

        def test_this(mail_outbox):
            first_subject = mail_outbox[0].subject

    """
    yield mail.outbox

    mail.outbox = []