mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +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 chatmaild.dictproxy
|
||||
from .dictproxy import get_user_data, lookup_passdb
|
||||
from .database import Database, DBError
|
||||
from chatmaild.dictproxy import get_user_data, lookup_passdb
|
||||
from chatmaild.database import Database, DBError
|
||||
|
||||
|
||||
@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 import policy
|
||||
import pytest
|
||||
@@ -6,10 +6,14 @@ import subprocess
|
||||
import imaplib
|
||||
import smtplib
|
||||
import itertools
|
||||
from pathlib import Path
|
||||
from math import ceil
|
||||
import pytest
|
||||
|
||||
|
||||
conftestdir = Path(__file__).parent
|
||||
|
||||
|
||||
def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--slow", action="store_true", default=False, help="also run slow tests"
|
||||
@@ -282,9 +286,11 @@ class Remote:
|
||||
|
||||
@pytest.fixture
|
||||
def mailgen(request):
|
||||
datadir = conftestdir.joinpath("mail-data")
|
||||
|
||||
class Mailgen:
|
||||
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 Mailgen()
|
||||
Reference in New Issue
Block a user