mirror of
https://github.com/chatmail/relay.git
synced 2026-05-19 04:18:09 +00:00
address review comments: renamed test and using socketserver ThreadingUnixStreamServer
This commit is contained in:
@@ -1,10 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from socketserver import (
|
from socketserver import StreamRequestHandler, ThreadingUnixStreamServer
|
||||||
StreamRequestHandler,
|
|
||||||
ThreadingMixIn,
|
|
||||||
UnixStreamServer,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class DictProxy:
|
class DictProxy:
|
||||||
@@ -86,12 +82,8 @@ class DictProxy:
|
|||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
with ThreadedUnixStreamServer(socket, Handler) as server:
|
with ThreadingUnixStreamServer(socket, Handler) as server:
|
||||||
try:
|
try:
|
||||||
server.serve_forever()
|
server.serve_forever()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ThreadedUnixStreamServer(ThreadingMixIn, UnixStreamServer):
|
|
||||||
request_queue_size = 100
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ def test_handle_dovecot_protocol_hello_is_skipped(db, example_config, caplog):
|
|||||||
assert not caplog.messages
|
assert not caplog.messages
|
||||||
|
|
||||||
|
|
||||||
def test_handle_dovecot_protocol(db, example_config):
|
def test_handle_dovecot_protocol_user_not_exists(db, example_config):
|
||||||
dictproxy = AuthDictProxy(db=db, config=example_config)
|
dictproxy = AuthDictProxy(db=db, config=example_config)
|
||||||
rfile = io.BytesIO(
|
rfile = io.BytesIO(
|
||||||
b"H3\t2\t0\t\tauth\nLshared/userdb/foobar@chat.example.org\tfoobar@chat.example.org\n"
|
b"H3\t2\t0\t\tauth\nLshared/userdb/foobar@chat.example.org\tfoobar@chat.example.org\n"
|
||||||
|
|||||||
Reference in New Issue
Block a user