Package lib :: Module xmpp_mocks :: Class MockConnection
[hide private]
[frames] | no frames]

Class MockConnection

source code


Class simulating Connection class from src/common/connection.py

It is derived from Mock in order to avoid defining all methods from real Connection that are called from NBClient or Dispatcher ( _event_dispatcher for example)

Instance Methods [hide private]
 
__init__(self, *args)
The Mock class constructor takes a dictionary of method names and the values they return.
source code
 
on_connect(self, success, *args)
Method called after connecting - after receiving <stream:features> from server (NOT after TLS stream restart) or connect failure
source code
 
on_auth(self, con, auth)
Method called after authentication, regardless of the result.
source code

Inherited from IdleMock: set_event, wait

Inherited from mock.Mock: __getattr__, getAllCalls, getNamedCalls, mockAddReturnValues, mockCheckCall, mockGetAllCalls, mockGetNamedCalls, mockSetExpectation

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args)
(Constructor)

source code 
The Mock class constructor takes a dictionary of method names and the values they return. Methods that are not in the returnValues dictionary will return None. You may also supply a class whose interface is being mocked. All calls will be checked to see if they appear in the original interface. Any calls to methods not appearing in the real class will raise a MockInterfaceError. Any calls that would fail due to non-matching parameter lists will also raise a MockInterfaceError. Both of these help to prevent the Mock class getting out of sync with the class it is Mocking.
Overrides: object.__init__
(inherited documentation)

on_connect(self, success, *args)

source code 
Method called after connecting - after receiving <stream:features> from server (NOT after TLS stream restart) or connect failure

on_auth(self, con, auth)

source code 
Method called after authentication, regardless of the result.
Parameters:
  • con (NonBlockingClient) - reference to authenticated object
  • auth (string) - type of authetication in case of success ('old_auth', 'sasl') or None in case of auth failure