Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.test_smtplib.GeneralTests Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def testQuoteData
def testBasic1
def testBasic2
def testLocalHostName
def testTimeoutDefault
def testTimeoutNone
def testTimeoutValue

Public Attributes

 port

Detailed Description

Definition at line 53 of file test_smtplib.py.


Member Function Documentation

Definition at line 55 of file test_smtplib.py.

00055 
00056     def setUp(self):
00057         smtplib.socket = mock_socket
00058         self.port = 25

Here is the caller graph for this function:

Definition at line 59 of file test_smtplib.py.

00059 
00060     def tearDown(self):
00061         smtplib.socket = socket

Here is the caller graph for this function:

Definition at line 69 of file test_smtplib.py.

00069 
00070     def testBasic1(self):
00071         mock_socket.reply_with(b"220 Hola mundo")
00072         # connects
00073         smtp = smtplib.SMTP(HOST, self.port)
00074         smtp.close()

Definition at line 75 of file test_smtplib.py.

00075 
00076     def testBasic2(self):
00077         mock_socket.reply_with(b"220 Hola mundo")
00078         # connects, include port in host name
00079         smtp = smtplib.SMTP("%s:%s" % (HOST, self.port))
00080         smtp.close()

Definition at line 81 of file test_smtplib.py.

00081 
00082     def testLocalHostName(self):
00083         mock_socket.reply_with(b"220 Hola mundo")
00084         # check that supplied local_hostname is used
00085         smtp = smtplib.SMTP(HOST, self.port, local_hostname="testhost")
00086         self.assertEqual(smtp.local_hostname, "testhost")
00087         smtp.close()

Here is the call graph for this function:

Definition at line 64 of file test_smtplib.py.

00064 
00065     def testQuoteData(self):
00066         teststr  = "abc\n.jkl\rfoo\r\n..blue"
00067         expected = "abc\r\n..jkl\r\nfoo\r\n...blue"
00068         self.assertEqual(expected, smtplib.quotedata(teststr))

Here is the call graph for this function:

Definition at line 88 of file test_smtplib.py.

00088 
00089     def testTimeoutDefault(self):
00090         mock_socket.reply_with(b"220 Hola mundo")
00091         self.assertTrue(mock_socket.getdefaulttimeout() is None)
00092         mock_socket.setdefaulttimeout(30)
00093         self.assertEqual(mock_socket.getdefaulttimeout(), 30)
00094         try:
00095             smtp = smtplib.SMTP(HOST, self.port)
00096         finally:
00097             mock_socket.setdefaulttimeout(None)
00098         self.assertEqual(smtp.sock.gettimeout(), 30)
00099         smtp.close()

Here is the call graph for this function:

Definition at line 100 of file test_smtplib.py.

00100 
00101     def testTimeoutNone(self):
00102         mock_socket.reply_with(b"220 Hola mundo")
00103         self.assertTrue(socket.getdefaulttimeout() is None)
00104         socket.setdefaulttimeout(30)
00105         try:
00106             smtp = smtplib.SMTP(HOST, self.port, timeout=None)
00107         finally:
00108             socket.setdefaulttimeout(None)
00109         self.assertTrue(smtp.sock.gettimeout() is None)
00110         smtp.close()

Here is the call graph for this function:

Definition at line 111 of file test_smtplib.py.

00111 
00112     def testTimeoutValue(self):
00113         mock_socket.reply_with(b"220 Hola mundo")
00114         smtp = smtplib.SMTP(HOST, self.port, timeout=30)
00115         self.assertEqual(smtp.sock.gettimeout(), 30)
00116         smtp.close()
00117 
00118 
# Test server thread using the specified SMTP server class

Here is the call graph for this function:


Member Data Documentation

Definition at line 57 of file test_smtplib.py.


The documentation for this class was generated from the following file: