mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 12:28:06 +00:00
move all tests into a root "tests" folder so they can share setup and config
This commit is contained in:
@@ -3,8 +3,8 @@ import os
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import chatmaild.dictproxy
|
import chatmaild.dictproxy
|
||||||
from .dictproxy import get_user_data, lookup_passdb
|
from chatmaild.dictproxy import get_user_data, lookup_passdb
|
||||||
from .database import Database, DBError
|
from chatmaild.database import Database, DBError
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from .filtermail import check_encrypted, check_DATA, SendRateLimiter
|
from chatmaild.filtermail import check_encrypted, check_DATA, SendRateLimiter
|
||||||
from email.parser import BytesParser
|
from email.parser import BytesParser
|
||||||
from email import policy
|
from email import policy
|
||||||
import pytest
|
import pytest
|
||||||
@@ -6,10 +6,14 @@ import subprocess
|
|||||||
import imaplib
|
import imaplib
|
||||||
import smtplib
|
import smtplib
|
||||||
import itertools
|
import itertools
|
||||||
|
from pathlib import Path
|
||||||
from math import ceil
|
from math import ceil
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|
||||||
|
conftestdir = Path(__file__).parent
|
||||||
|
|
||||||
|
|
||||||
def pytest_addoption(parser):
|
def pytest_addoption(parser):
|
||||||
parser.addoption(
|
parser.addoption(
|
||||||
"--slow", action="store_true", default=False, help="also run slow tests"
|
"--slow", action="store_true", default=False, help="also run slow tests"
|
||||||
@@ -282,9 +286,11 @@ class Remote:
|
|||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def mailgen(request):
|
def mailgen(request):
|
||||||
|
datadir = conftestdir.joinpath("mail-data")
|
||||||
|
|
||||||
class Mailgen:
|
class Mailgen:
|
||||||
def get_encrypted(self, from_addr, to_addr):
|
def get_encrypted(self, from_addr, to_addr):
|
||||||
data = request.fspath.dirpath("mailgen/encrypted.eml").read()
|
data = datadir.joinpath("encrypted.eml").read_text()
|
||||||
return data.format(from_addr=from_addr, to_addr=to_addr)
|
return data.format(from_addr=from_addr, to_addr=to_addr)
|
||||||
|
|
||||||
return Mailgen()
|
return Mailgen()
|
||||||
Reference in New Issue
Block a user