diff --git a/online-tests/conftest.py b/online-tests/conftest.py index 319bea3..f98a089 100644 --- a/online-tests/conftest.py +++ b/online-tests/conftest.py @@ -1,4 +1,5 @@ import imaplib +import smtplib import itertools import pytest @@ -21,6 +22,24 @@ class ImapConn: self.conn.login(user, password) +@pytest.fixture +def smtp(): + return SmtpConn("c1.testrun.org") + + +class SmtpConn: + def __init__(self, host): + self.host = host + + def connect(self): + print(f"smtp-connect {self.host}") + self.conn = smtplib.SMTP_SSL(self.host) + + def login(self, user, password): + print(f"smtp-login {user!r} {password!r}") + self.conn.login(user, password) + + @pytest.fixture def gencreds(): count = itertools.count() diff --git a/scripts/init.sh b/scripts/init.sh index 4f7dc33..889f8ba 100755 --- a/scripts/init.sh +++ b/scripts/init.sh @@ -9,4 +9,4 @@ doveauth/venv/bin/pip install pytest build doveauth/venv/bin/pip install -e doveauth python3 -m venv online-tests/venv -online-tests/venv/bin/pip install pytest pytest-timeout +online-tests/venv/bin/pip install pytest pytest-timeout pdbpp diff --git a/scripts/test.sh b/scripts/test.sh index 4e5ab98..0bca51c 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -2,4 +2,5 @@ pushd doveauth/src/doveauth ../../venv/bin/pytest popd -online-tests/venv/bin/pytest online-tests/ + +online-tests/venv/bin/pytest online-tests/ -vrx