Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes
test.mock_socket.MockSocket Class Reference

List of all members.

Public Member Functions

def __init__
def queue_recv
def recv
def fileno
def settimeout
def gettimeout
def setsockopt
def getsockopt
def bind
def accept
def getsockname
def setblocking
def listen
def makefile
def sendall
def send
def getpeername
def close

Public Attributes

 output
 lines
 conn
 timeout
 last

Detailed Description

Mock socket object used by smtpd and smtplib tests.

Definition at line 30 of file mock_socket.py.


Constructor & Destructor Documentation

Definition at line 33 of file mock_socket.py.

00033 
00034     def __init__(self):
00035         global _reply_data
00036         self.output = []
00037         self.lines = []
00038         if _reply_data:
00039             self.lines.append(_reply_data)
00040             _reply_data = None
00041         self.conn = None
00042         self.timeout = None

Here is the caller graph for this function:


Member Function Documentation

Definition at line 71 of file mock_socket.py.

00071 
00072     def accept(self):
00073         self.conn = MockSocket()
00074         return self.conn, 'c'

def test.mock_socket.MockSocket.bind (   self,
  address 
)

Definition at line 68 of file mock_socket.py.

00068 
00069     def bind(self, address):
00070         pass

Here is the caller graph for this function:

Definition at line 101 of file mock_socket.py.

00101 
00102     def close(self):
00103         pass
00104 

Here is the caller graph for this function:

Definition at line 50 of file mock_socket.py.

00050 
00051     def fileno(self):
00052         return 0

Here is the caller graph for this function:

Definition at line 98 of file mock_socket.py.

00098 
00099     def getpeername(self):
00100         return 'peer'

Definition at line 75 of file mock_socket.py.

00075 
00076     def getsockname(self):
00077         return ('0.0.0.0', 0)

def test.mock_socket.MockSocket.getsockopt (   self,
  level,
  optname,
  buflen = None 
)

Definition at line 65 of file mock_socket.py.

00065 
00066     def getsockopt(self, level, optname, buflen=None):
00067         return 0

Definition at line 59 of file mock_socket.py.

00059 
00060     def gettimeout(self):
00061         return self.timeout

Here is the caller graph for this function:

def test.mock_socket.MockSocket.listen (   self,
  backlog 
)

Definition at line 81 of file mock_socket.py.

00081 
00082     def listen(self, backlog):
00083         pass

Here is the caller graph for this function:

def test.mock_socket.MockSocket.makefile (   self,
  mode = 'r',
  bufsize = -1 
)

Definition at line 84 of file mock_socket.py.

00084 
00085     def makefile(self, mode='r', bufsize=-1):
00086         handle = MockFile(self.lines)
00087         return handle

def test.mock_socket.MockSocket.queue_recv (   self,
  line 
)

Definition at line 43 of file mock_socket.py.

00043 
00044     def queue_recv(self, line):
00045         self.lines.append(line)

def test.mock_socket.MockSocket.recv (   self,
  bufsize,
  flags = None 
)

Definition at line 46 of file mock_socket.py.

00046 
00047     def recv(self, bufsize, flags=None):
00048         data = self.lines.pop(0) + b'\r\n'
00049         return data

Here is the caller graph for this function:

def test.mock_socket.MockSocket.send (   self,
  data,
  flags = None 
)

Definition at line 93 of file mock_socket.py.

00093 
00094     def send(self, data, flags=None):
00095         self.last = data
00096         self.output.append(data)
00097         return len(data)

Here is the caller graph for this function:

def test.mock_socket.MockSocket.sendall (   self,
  buffer,
  flags = None 
)

Definition at line 88 of file mock_socket.py.

00088 
00089     def sendall(self, buffer, flags=None):
00090         self.last = data
00091         self.output.append(data)
00092         return len(data)

def test.mock_socket.MockSocket.setblocking (   self,
  flag 
)

Definition at line 78 of file mock_socket.py.

00078 
00079     def setblocking(self, flag):
00080         pass

def test.mock_socket.MockSocket.setsockopt (   self,
  level,
  optname,
  value 
)

Definition at line 62 of file mock_socket.py.

00062 
00063     def setsockopt(self, level, optname, value):
00064         pass

def test.mock_socket.MockSocket.settimeout (   self,
  timeout 
)

Definition at line 53 of file mock_socket.py.

00053 
00054     def settimeout(self, timeout):
00055         if timeout is None:
00056             self.timeout = _defaulttimeout
00057         else:
00058             self.timeout = timeout

Here is the caller graph for this function:


Member Data Documentation

Definition at line 40 of file mock_socket.py.

Definition at line 89 of file mock_socket.py.

Definition at line 36 of file mock_socket.py.

Definition at line 35 of file mock_socket.py.

Definition at line 41 of file mock_socket.py.


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