summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_smtpd.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-07-31 10:08:09 (GMT)
committerGeorg Brandl <georg@python.org>2010-07-31 10:08:09 (GMT)
commit17e3d698b512025d525c1ecb6b0531b575ad5518 (patch)
treec31086172ace8d2a6be741771fbb68aedc5b5b8f /Lib/test/test_smtpd.py
parentca9400f0519261a0d8a282ff1dcaadaddf00fd64 (diff)
downloadcpython-17e3d698b512025d525c1ecb6b0531b575ad5518.zip
cpython-17e3d698b512025d525c1ecb6b0531b575ad5518.tar.gz
cpython-17e3d698b512025d525c1ecb6b0531b575ad5518.tar.bz2
Avoid triggering DeprecationWarnings in test_smtpd and smtpd.
Diffstat (limited to 'Lib/test/test_smtpd.py')
-rw-r--r--Lib/test/test_smtpd.py53
1 files changed, 27 insertions, 26 deletions
diff --git a/Lib/test/test_smtpd.py b/Lib/test/test_smtpd.py
index 538525b..2b781bd 100644
--- a/Lib/test/test_smtpd.py
+++ b/Lib/test/test_smtpd.py
@@ -79,101 +79,102 @@ class SMTPDChannelTest(TestCase):
def test_missing_data(self):
self.write_line(b'')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'500 Error: bad syntax\r\n')
def test_EHLO_not_implemented(self):
self.write_line(b'EHLO test.example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'502 Error: command "EHLO" not implemented\r\n')
def test_HELO(self):
name = socket.getfqdn()
self.write_line(b'HELO test.example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
'250 {}\r\n'.format(name).encode('ascii'))
def test_HELO_bad_syntax(self):
self.write_line(b'HELO')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'501 Syntax: HELO hostname\r\n')
def test_HELO_duplicate(self):
self.write_line(b'HELO test.example')
self.write_line(b'HELO test.example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'503 Duplicate HELO/EHLO\r\n')
def test_NOOP(self):
self.write_line(b'NOOP')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
def test_NOOP_bad_syntax(self):
self.write_line(b'NOOP hi')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'501 Syntax: NOOP\r\n')
def test_QUIT(self):
self.write_line(b'QUIT')
- self.assertEqual(self.channel.last, b'221 Bye\r\n')
+ self.assertEqual(self.channel.socket.last, b'221 Bye\r\n')
def test_QUIT_arg_ignored(self):
self.write_line(b'QUIT bye bye')
- self.assertEqual(self.channel.last, b'221 Bye\r\n')
+ self.assertEqual(self.channel.socket.last, b'221 Bye\r\n')
def test_bad_state(self):
- self.channel._SMTPChannel__state = 'BAD STATE'
+ self.channel.smtp_state = 'BAD STATE'
self.write_line(b'HELO')
- self.assertEqual(self.channel.last, b'451 Internal confusion\r\n')
+ self.assertEqual(self.channel.socket.last,
+ b'451 Internal confusion\r\n')
def test_need_MAIL(self):
self.write_line(b'RCPT to:spam@example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'503 Error: need MAIL command\r\n')
def test_MAIL_syntax(self):
self.write_line(b'MAIL from eggs@example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'501 Syntax: MAIL FROM:<address>\r\n')
def test_MAIL_missing_from(self):
self.write_line(b'MAIL from:')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'501 Syntax: MAIL FROM:<address>\r\n')
def test_MAIL_chevrons(self):
self.write_line(b'MAIL from:<eggs@example>')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
def test_nested_MAIL(self):
self.write_line(b'MAIL from:eggs@example')
self.write_line(b'MAIL from:spam@example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'503 Error: nested MAIL command\r\n')
def test_need_RCPT(self):
self.write_line(b'MAIL From:eggs@example')
self.write_line(b'DATA')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'503 Error: need RCPT command\r\n')
def test_RCPT_syntax(self):
self.write_line(b'MAIL From:eggs@example')
self.write_line(b'RCPT to eggs@example')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'501 Syntax: RCPT TO: <address>\r\n')
def test_data_dialog(self):
self.write_line(b'MAIL From:eggs@example')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
self.write_line(b'RCPT To:spam@example')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
self.write_line(b'DATA')
- self.assertEqual(self.channel.last,
+ self.assertEqual(self.channel.socket.last,
b'354 End data with <CR><LF>.<CR><LF>\r\n')
self.write_line(b'data\r\nmore\r\n.')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
self.assertEqual(self.server.messages[-1],
('peer', 'eggs@example', ['spam@example'], 'data\nmore'))
@@ -181,7 +182,7 @@ class SMTPDChannelTest(TestCase):
self.write_line(b'MAIL From:eggs@example')
self.write_line(b'RCPT To:spam@example')
self.write_line(b'DATA spam')
- self.assertEqual(self.channel.last, b'501 Syntax: DATA\r\n')
+ self.assertEqual(self.channel.socket.last, b'501 Syntax: DATA\r\n')
def test_multiple_RCPT(self):
self.write_line(b'MAIL From:eggs@example')
@@ -197,13 +198,13 @@ class SMTPDChannelTest(TestCase):
self.write_line(b'RCPT To:spam@example')
self.write_line(b'DATA')
self.write_line(b'return status\r\n.')
- self.assertEqual(self.channel.last, b'250 Okish\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Okish\r\n')
def test_RSET(self):
self.write_line(b'MAIL From:eggs@example')
self.write_line(b'RCPT To:spam@example')
self.write_line(b'RSET')
- self.assertEqual(self.channel.last, b'250 Ok\r\n')
+ self.assertEqual(self.channel.socket.last, b'250 Ok\r\n')
self.write_line(b'MAIL From:foo@example')
self.write_line(b'RCPT To:eggs@example')
self.write_line(b'DATA')
@@ -213,7 +214,7 @@ class SMTPDChannelTest(TestCase):
def test_RSET_syntax(self):
self.write_line(b'RSET hi')
- self.assertEqual(self.channel.last, b'501 Syntax: RSET\r\n')
+ self.assertEqual(self.channel.socket.last, b'501 Syntax: RSET\r\n')
def test_main():