Skip to content

Commit

Permalink
100% coverage for IMAP4Server wire protocol parsing.
Browse files Browse the repository at this point in the history
  • Loading branch information
markrwilliams committed Jul 22, 2017
1 parent 0008298 commit d9138df
Show file tree
Hide file tree
Showing 2 changed files with 655 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/twisted/mail/imap4.py
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,8 @@ def arg_astring(self, line, final=False):
try:
size = int(line[1:-1])
except ValueError:
raise IllegalClientResponse("Bad literal size: " + line[1:-1])
raise IllegalClientResponse(
"Bad literal size: " + repr(line[1:-1]))
if final and not size:
return (b'', b'')
d = self._stringLiteral(size)
Expand Down Expand Up @@ -1048,7 +1049,7 @@ def opt_datetime(self, line):
if line.startswith(b'"'):
try:
spam, date, rest = line.split(b'"',2)
except IndexError:
except ValueError:
raise IllegalClientResponse("Malformed date-time")
return (date, rest[1:])
else:
Expand All @@ -1064,7 +1065,7 @@ def opt_charset(self, line):
if len(arg) == 1:
raise IllegalClientResponse("Missing charset identifier")
if len(arg) == 2:
arg.append('')
arg.append(b'')
spam, arg, rest = arg
return (arg, rest)
else:
Expand Down
Loading

0 comments on commit d9138df

Please sign in to comment.