Back to index

python3.2  3.2.2
Classes | Functions | Variables
test.test_smtplib Namespace Reference

Classes

class  GeneralTests
class  DebuggingServerTests
class  NonConnectingTests
class  BadHELOServerTests
class  SimSMTPChannel
class  SimSMTPServer
class  SMTPSimTests

Functions

def handle_expt
def server
def debugging_server
def test_main

Variables

 threading = None
 HOST = support.HOST
string MSG_BEGIN = '---------- MESSAGE FOLLOWS ----------\n'
string MSG_END = '------------ END MESSAGE ------------\n'
dictionary sim_users
tuple sim_auth = ('Mr.A@somewhere.com', 'somepassword')
tuple sim_cram_md5_challenge
dictionary sim_auth_credentials
string sim_auth_login_password = 'C29TZXBHC3N3B3JK'
dictionary sim_lists

Function Documentation

def test.test_smtplib.debugging_server (   serv,
  serv_evt,
  client_evt 
)

Definition at line 119 of file test_smtplib.py.

00119 
00120 def debugging_server(serv, serv_evt, client_evt):
00121     serv_evt.set()
00122 
00123     try:
00124         if hasattr(select, 'poll'):
00125             poll_fun = asyncore.poll2
00126         else:
00127             poll_fun = asyncore.poll
00128 
00129         n = 1000
00130         while asyncore.socket_map and n > 0:
00131             poll_fun(0.01, asyncore.socket_map)
00132 
00133             # when the client conversation is finished, it will
00134             # set client_evt, and it's then ok to kill the server
00135             if client_evt.is_set():
00136                 serv.close()
00137                 break
00138 
00139             n -= 1
00140 
00141     except socket.timeout:
00142         pass
00143     finally:
00144         if not client_evt.is_set():
00145             # allow some time for the client to read the result
00146             time.sleep(0.5)
00147             serv.close()
00148         asyncore.close_all()
00149         serv_evt.set()

Here is the call graph for this function:

Definition at line 26 of file test_smtplib.py.

00026 
00027     def handle_expt(self):
        pass
def test.test_smtplib.server (   evt,
  buf,
  serv 
)

Definition at line 31 of file test_smtplib.py.

00031 
00032 def server(evt, buf, serv):
00033     serv.listen(5)
00034     evt.set()
00035     try:
00036         conn, addr = serv.accept()
00037     except socket.timeout:
00038         pass
00039     else:
00040         n = 500
00041         while buf and n > 0:
00042             r, w, e = select.select([], [conn], [])
00043             if w:
00044                 sent = conn.send(buf)
00045                 buf = buf[sent:]
00046 
00047             n -= 1
00048 
00049         conn.close()
00050     finally:
00051         serv.close()
00052         evt.set()

def test.test_smtplib.test_main (   verbose = None)

Definition at line 763 of file test_smtplib.py.

00763 
00764 def test_main(verbose=None):
00765     support.run_unittest(GeneralTests, DebuggingServerTests,
00766                               NonConnectingTests,
00767                               BadHELOServerTests, SMTPSimTests)


Variable Documentation

Definition at line 21 of file test_smtplib.py.

string test.test_smtplib.MSG_BEGIN = '---------- MESSAGE FOLLOWS ----------\n'

Definition at line 150 of file test_smtplib.py.

string test.test_smtplib.MSG_END = '------------ END MESSAGE ------------\n'

Definition at line 151 of file test_smtplib.py.

tuple test.test_smtplib.sim_auth = ('Mr.A@somewhere.com', 'somepassword')

Definition at line 547 of file test_smtplib.py.

Initial value:
00001 {
00002     'login': 'TXIuQUBzb21ld2hlcmUuY29t',
00003     'plain': 'AE1yLkFAc29tZXdoZXJlLmNvbQBzb21lcGFzc3dvcmQ=',
00004     'cram-md5': ('TXIUQUBZB21LD2HLCMUUY29TIDG4OWQ0MJ'
00005                  'KWZGQ4ODNMNDA4NTGXMDRLZWMYZJDMODG1'),
00006     }

Definition at line 550 of file test_smtplib.py.

Definition at line 556 of file test_smtplib.py.

Initial value:
00001 ('PENCeUxFREJoU0NnbmhNWitOMjNGNn'
00002                           'dAZWx3b29kLmlubm9zb2Z0LmNvbT4=')

Definition at line 548 of file test_smtplib.py.

Initial value:
00001 {'list-1':['Mr.A@somewhere.com','Mrs.C@somewhereesle.com'],
00002              'list-2':['Ms.B@xn--fo-fka.com',],
00003             }

Definition at line 558 of file test_smtplib.py.

Initial value:
00001 {'Mr.A@somewhere.com':'John A',
00002              'Ms.B@xn--fo-fka.com':'Sally B',
00003              'Mrs.C@somewhereesle.com':'Ruth C',
00004             }

Definition at line 542 of file test_smtplib.py.

Definition at line 19 of file test_smtplib.py.