Skip to content

Commit

Permalink
A little more converage.
Browse files Browse the repository at this point in the history
  • Loading branch information
warsaw committed Oct 20, 2015
1 parent c6a24c2 commit ba195ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion aiosmtpd/smtp.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def _handle_client(self):
command = line[:i].upper()
arg = line[i+1:].strip()
max_sz = (self.command_size_limits[command]
if self.extended_smtp else self.command_size_limit)
if self.extended_smtp
else self.command_size_limit)
if len(line) > max_sz:
yield from self.push('500 Error: line too long')
continue
Expand Down
9 changes: 9 additions & 0 deletions aiosmtpd/tests/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,12 @@ def test_smtp_utf8(self):
code, response = client.ehlo('example.com')
self.assertEqual(code, 250)
self.assertIn(b'SMTPUTF8', response.splitlines())

def test_default_max_command_size_limit(self):
server = Server(Sink())
self.assertEqual(server.max_command_size_limit, 512)

def test_special_max_command_size_limit(self):
server = Server(Sink())
server.command_size_limits['DATA'] = 1024
self.assertEqual(server.max_command_size_limit, 1024)

0 comments on commit ba195ac

Please sign in to comment.