Compare commits
No commits in common. "2c6d98ce2daadfadfaee176ae283e3d029e1311c" and "fbb2cf38aeb5fa61120926a8f05942313219a7ba" have entirely different histories.
2c6d98ce2d
...
fbb2cf38ae
@ -2,8 +2,11 @@ import asyncio
|
|||||||
import contextlib
|
import contextlib
|
||||||
import contextvars
|
import contextvars
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
|
import uuid
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
from hashlib import sha256
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from .config import User
|
from .config import User
|
||||||
from .pwhash import parse_hash, check_pass, PWInfo
|
from .pwhash import parse_hash, check_pass, PWInfo
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
import asyncio
|
import asyncio
|
||||||
|
import io
|
||||||
import logging
|
import logging
|
||||||
|
import mailbox
|
||||||
import ssl
|
import ssl
|
||||||
import uuid
|
import uuid
|
||||||
import shutil
|
import shutil
|
||||||
@ -11,9 +13,11 @@ from email.message import Message
|
|||||||
import email.policy
|
import email.policy
|
||||||
from email.generator import BytesGenerator
|
from email.generator import BytesGenerator
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import random
|
||||||
|
|
||||||
from aiosmtpd.handlers import AsyncMessage
|
from aiosmtpd.handlers import Mailbox, AsyncMessage
|
||||||
from aiosmtpd.smtp import SMTP
|
from aiosmtpd.smtp import SMTP, DATA_SIZE_DEFAULT
|
||||||
|
from aiosmtpd.smtp import SMTP as SMTPServer
|
||||||
from aiosmtpd.smtp import Envelope as SMTPEnvelope
|
from aiosmtpd.smtp import Envelope as SMTPEnvelope
|
||||||
from aiosmtpd.smtp import Session as SMTPSession
|
from aiosmtpd.smtp import Session as SMTPSession
|
||||||
|
|
||||||
@ -27,7 +31,7 @@ class MyHandler(AsyncMessage):
|
|||||||
self.mbox_finder = mbox_finder
|
self.mbox_finder = mbox_finder
|
||||||
|
|
||||||
async def handle_DATA(
|
async def handle_DATA(
|
||||||
self, server: SMTP, session: SMTPSession, envelope: SMTPEnvelope
|
self, server: SMTPServer, session: SMTPSession, envelope: SMTPEnvelope
|
||||||
) -> str:
|
) -> str:
|
||||||
self.rcpt_tos = envelope.rcpt_tos
|
self.rcpt_tos = envelope.rcpt_tos
|
||||||
self.peer = session.peer
|
self.peer = session.peer
|
||||||
|
@ -89,9 +89,6 @@ class TestPop3(unittest.IsolatedAsyncioTestCase):
|
|||||||
self.task = asyncio.create_task(pop_server.serve_forever())
|
self.task = asyncio.create_task(pop_server.serve_forever())
|
||||||
self.reader, self.writer = await asyncio.open_connection("127.0.0.1", 7995)
|
self.reader, self.writer = await asyncio.open_connection("127.0.0.1", 7995)
|
||||||
|
|
||||||
# Additional writers to close
|
|
||||||
self.ws: list[asyncio.StreamWriter] = []
|
|
||||||
|
|
||||||
async def test_QUIT(self) -> None:
|
async def test_QUIT(self) -> None:
|
||||||
dialog = """
|
dialog = """
|
||||||
S: +OK Server Ready
|
S: +OK Server Ready
|
||||||
@ -136,7 +133,6 @@ class TestPop3(unittest.IsolatedAsyncioTestCase):
|
|||||||
async def test_dupe_AUTH(self) -> None:
|
async def test_dupe_AUTH(self) -> None:
|
||||||
r1, w1 = await asyncio.open_connection("127.0.0.1", 7995)
|
r1, w1 = await asyncio.open_connection("127.0.0.1", 7995)
|
||||||
r2, w2 = await asyncio.open_connection("127.0.0.1", 7995)
|
r2, w2 = await asyncio.open_connection("127.0.0.1", 7995)
|
||||||
self.ws += w1, w2
|
|
||||||
dialog = """
|
dialog = """
|
||||||
S: +OK Server Ready
|
S: +OK Server Ready
|
||||||
C: USER foobar
|
C: USER foobar
|
||||||
@ -235,10 +231,8 @@ class TestPop3(unittest.IsolatedAsyncioTestCase):
|
|||||||
|
|
||||||
async def asyncTearDown(self) -> None:
|
async def asyncTearDown(self) -> None:
|
||||||
logging.debug("at teardown")
|
logging.debug("at teardown")
|
||||||
for w in self.ws + [self.writer]:
|
self.writer.close()
|
||||||
w.close()
|
await self.writer.wait_closed()
|
||||||
await w.wait_closed()
|
|
||||||
self.ws.clear()
|
|
||||||
self.task.cancel("test done")
|
self.task.cancel("test done")
|
||||||
|
|
||||||
async def dialog_checker(self, dialog: str) -> None:
|
async def dialog_checker(self, dialog: str) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user