mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
dovecot: Add tests for more error cases
This patch adds more tests for the dovecot library, in particular: - Protocol errors (invalid versions, etc.). - Invalid command (cli-specific test). - Connection breakups.
This commit is contained in:
@@ -42,6 +42,8 @@ class Process (object):
|
||||
def wait(self):
|
||||
return self.cmd.wait()
|
||||
|
||||
def close(self):
|
||||
return self.cmd.terminate()
|
||||
|
||||
class Sock (object):
|
||||
"""A (generic) socket.
|
||||
@@ -77,6 +79,10 @@ class Sock (object):
|
||||
self.has_conn.wait()
|
||||
return self.connr.readline()
|
||||
|
||||
def close(self):
|
||||
self.connr.close()
|
||||
self.connw.close()
|
||||
self.sock.close()
|
||||
|
||||
class UnixSock (Sock):
|
||||
def __init__(self, addr):
|
||||
@@ -239,6 +245,10 @@ class Interpreter (object):
|
||||
self.runtime_error("return code did not match:\n"
|
||||
+ " expected %s, got %d" % (params, retcode))
|
||||
|
||||
# close Close the process.
|
||||
elif op == "close":
|
||||
self.procs[proc].close()
|
||||
|
||||
else:
|
||||
self.syntax_error("unknown syntax")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user