예제 #1
0
 def test_send(self):
     sock = Chat(self.sock, line_term = "\r\n")
     sock.rexpect(ur"^220")
     sock.send("HELO unittesting")
     sock.rexpect(ur"^250")
     sock.send("MAIL FROM: <*****@*****.**>")
     sock.rexpect(ur"^250")
     sock.send("RCPT TO: <*****@*****.**>")
     sock.rexpect(ur"^250")
     sock.send("DATA")
     sock.rexpect(ur"^354")
     sock.send('From: "John Smith" <*****@*****.**>')
     sock.send('To: "Jane Doe" <*****@*****.**>')
     sock.send('Subject: test message sent from manual telnet session')
     sock.send('Date: Wed, 11 May 2011 16:19:57 -0400\r\n')
     sock.send('Hello World,')
     sock.send('This is a test message sent from a manual telnet session.\r\n')
     sock.send('Yours truly,')
     sock.send('SMTP administrator')
     sock.send('.')
     sock.rexpect(ur"^250")
     sock.send("QUIT")
     sock.rexpect(ur"^221")
     self.assertIsNotNone(self.beanstalk.reserve(timeout = 30))