mirror of
https://github.com/chatmail/relay.git
synced 2026-05-10 16:04:37 +00:00
make tests depend on chatmail.ini, not env var
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
[params]
|
||||
|
||||
# mail domain (MUST be set to fully qualified chat mail domain)
|
||||
|
||||
65
plan.txt
65
plan.txt
@@ -1,65 +0,0 @@
|
||||
# Chat-mail server development (up until Oct 18th)
|
||||
|
||||
## Dovecot goals/steps
|
||||
|
||||
- automatic expiry of messages older than M days
|
||||
- also expunge unread messages
|
||||
|
||||
- limit: configure max-connections per account
|
||||
|
||||
|
||||
## nami: send out rate limit / rspamd
|
||||
|
||||
- basic outgoing send rate/limits (depending on "account-rating")
|
||||
use rspamd in a minimal way, check support dkim-signing
|
||||
(including an online test exceeding rate limit)
|
||||
|
||||
|
||||
## doveauth questions/futures
|
||||
|
||||
- bcrypt-password scheme is slow: require long passwords, use faster hashing
|
||||
|
||||
- define user-name and password policies, and implement them
|
||||
(be very restrictive at the beginning, we can relax later)
|
||||
|
||||
- password is part of the dictproxy-lookup key, is it safe to use auth-caching?
|
||||
|
||||
|
||||
## How to limit creation of accounts?
|
||||
|
||||
attack: a 3-line bash script to fill the chatmail db with millions of unused accouts
|
||||
|
||||
- make it computationally expensive (somehow try to except our tests from it)
|
||||
1st pass instant onboarding: create userid + cheap password -- if it fails then
|
||||
2nd pass instant onboarding: create userdid + comput. expensive password
|
||||
|
||||
- probably also do firewall: limit number of new tcp-connections per IP address per duration
|
||||
|
||||
|
||||
## Open/deferred questions
|
||||
|
||||
- automatic expiry of users that haven't logged in for N days
|
||||
Is it neccessary? If all messages are gone, does the existence of
|
||||
an e-mail address bother anybody?
|
||||
|
||||
|
||||
## web page for chat-mail servers?
|
||||
|
||||
- documentation for users, privacy policy etc.
|
||||
(probably also with provider-messages ...)
|
||||
|
||||
|
||||
## online tests (first with plain python/pytest)
|
||||
|
||||
- write tests for dovecot login (exists)
|
||||
- write tests for postfix logins (exists)
|
||||
- write A<>B send/receive tests (exists)
|
||||
|
||||
|
||||
## Delta Chat
|
||||
|
||||
1. qr code that defines access to a chatmail instance (like mailadm but without http etc.)
|
||||
|
||||
2. support for creating username/password and verifying login works
|
||||
|
||||
|
||||
@@ -3,10 +3,8 @@ import io
|
||||
import time
|
||||
import random
|
||||
import subprocess
|
||||
import textwrap
|
||||
import imaplib
|
||||
import smtplib
|
||||
import importlib.resources
|
||||
import itertools
|
||||
from email.parser import BytesParser
|
||||
from email import policy
|
||||
@@ -14,6 +12,7 @@ from pathlib import Path
|
||||
import pytest
|
||||
|
||||
from chatmaild.database import Database
|
||||
from chatmaild.config import read_config
|
||||
|
||||
|
||||
conftestdir = Path(__file__).parent
|
||||
@@ -39,13 +38,17 @@ def pytest_runtest_setup(item):
|
||||
pytest.skip("skipping slow test, use --slow to run")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def chatmail_config(pytestconfig):
|
||||
path = Path("chatmail.ini").resolve()
|
||||
if path.exists():
|
||||
return read_config(path)
|
||||
pytest.skip(f"no chatmail.ini file found in {path}")
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def maildomain():
|
||||
domain = os.environ.get("CHATMAIL_DOMAIN")
|
||||
if not domain:
|
||||
pytest.skip("set CHATMAIL_DOMAIN to a ssh-reachable chatmail instance")
|
||||
return domain
|
||||
def maildomain(chatmail_config):
|
||||
return chatmail_config.mailname
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -410,6 +413,7 @@ class CMUser:
|
||||
@pytest.fixture
|
||||
def make_config(tmp_path):
|
||||
from chatmaild.config import read_config, write_initial_config
|
||||
|
||||
inipath = tmp_path.joinpath("chatmail.ini")
|
||||
|
||||
def make_conf(mailname):
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import pytest
|
||||
from deploy_chatmail.cmdeploy import get_parser, main
|
||||
from chatmaild.config import read_config
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
import textwrap
|
||||
import importlib.resources
|
||||
|
||||
from deploy_chatmail.www import build_webpages
|
||||
from chatmaild.config import read_config
|
||||
|
||||
|
||||
|
||||
def test_build_webpages(tmp_path, make_config):
|
||||
@@ -13,4 +10,4 @@ def test_build_webpages(tmp_path, make_config):
|
||||
config = make_config("chat.example.org")
|
||||
build_dir = tmp_path.joinpath("build")
|
||||
build_webpages(src_dir, build_dir, config)
|
||||
assert len([x for x in build_dir.iterdir() if x.suffix == '.html']) >= 3
|
||||
assert len([x for x in build_dir.iterdir() if x.suffix == ".html"]) >= 3
|
||||
|
||||
Reference in New Issue
Block a user