1
0
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:
Alberto Bertogli
2018-06-04 01:20:51 +01:00
parent 36692b52d3
commit cf81fbee74
6 changed files with 104 additions and 0 deletions

View File

@@ -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")