mock.Mock.__init__

Here are the examples of the python api mock.Mock.__init__ taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

11 Examples 7

Example 1

Project: gajim Source File: mocks.py
Function: init
	def __init__(self, jid, account, *args):
		Mock.__init__(self, *args)

		self.jid = jid
		self.account = account

		self.parent_win = MockWindow({'get_active_control': self})
		self.session = None

Example 2

Project: gajim Source File: mocks.py
Function: init
	def __init__(self, conn, jid, thread_id, type_):
		Mock.__init__(self)

		self.conn = conn
		self.jid = jid
		self.type = type_
		self.thread_id = thread_id

		if not self.thread_id:
			self.thread_id = '%0x' % random.randint(0, 10000)

Example 3

Project: nsq-py Source File: mockedconnectiontest.py
Function: init
    def __init__(self, host=None, port=None, *args, **kwargs):
        mock.Mock.__init__(self)
        self.host = host
        self.port = port
        self._responses = []
        self._alive = True

Example 4

Project: airpnp Source File: test_airplayservice.py
    def __init__(self, *args, **kwargs):
        Mock.__init__(self, IAirPlayServer.names(), *args, **kwargs)

Example 5

Project: gajim Source File: mocks.py
	def __init__(self, account, *args):
		Mock.__init__(self, *args)
		ConnectionHandlersBase.__init__(self)

		self.name = account
		self.connected = 2
		self.mood = {}
		self.activity = {}
		self.tune = {}
		self.blocked_contacts = {}
		self.blocked_groups = {}
		self.sessions = {}

		gajim.interface.instances[account] = {'infos': {}, 'disco': {},
			'gc_config': {}, 'search': {}}
		gajim.interface.minimized_controls[account] = {}
		gajim.contacts.add_account(account)
		gajim.groups[account] = {}
		gajim.gc_connected[account] = {}
		gajim.automatic_rooms[account] = {}
		gajim.newly_added[account] = []
		gajim.to_be_removed[account] = []
		gajim.nicks[account] = gajim.config.get_per('accounts', account, 'name')
		gajim.block_signed_in_notifications[account] = True
		gajim.sleeper_state[account] = 0
		gajim.encrypted_chats[account] = []
		gajim.last_message_time[account] = {}
		gajim.status_before_autoaway[account] = ''
		gajim.transport_avatar[account] = {}
		gajim.gajim_optional_features[account] = []
		gajim.caps_hash[account] = ''

		gajim.connections[account] = self

Example 6

Project: gajim Source File: mocks.py
Function: init
	def __init__(self, *args):
		Mock.__init__(self, *args)
		self.window = Mock()
		self._controls = {}

Example 7

Project: gajim Source File: mocks.py
	def __init__(self, *args):
		Mock.__init__(self, *args)
		gajim.interface = self
		self.msg_win_mgr = Mock()
		self.roster = Mock()

		self.remote_ctrl = None
		self.instances = {}
		self.minimized_controls = {}
		self.status_sent_to_users = Mock()

		if gajim.use_x:
			self.jabber_state_images = {'16': {}, '32': {}, 'opened': {},
				'closed': {}}

			import gtkgui_helpers
			gtkgui_helpers.make_jabber_state_images()
		else:
			self.jabber_state_images = {'16': Mock(), '32': Mock(),
				'opened': Mock(), 'closed': Mock()}

Example 8

Project: gajim Source File: mocks.py
Function: init
	def __init__(self):
		Mock.__init__(self, {'write': None, 'get_transports_type': {}})

Example 9

Project: gajim Source File: test_caps.py
Function: init
	def __init__(self, *args):
		Mock.__init__(self, *args)

Example 10

Project: nsq-py Source File: mockedsockettest.py
Function: init
    def __init__(self, *_, **__):
        mock.Mock.__init__(self)
        self._to_client_buffer = ''
        self._to_server_buffer = ''

Example 11

Project: manila Source File: test_cephfs_native.py
Function: init
        def __init__(self, *args, **kwargs):
            mock.Mock.__init__(self, spec=[
                "connect", "disconnect",
                "create_snapshot_volume", "destroy_snapshot_volume",
                "create_group", "destroy_group",
                "delete_volume", "purge_volume",
                "deauthorize", "evict", "set_max_bytes",
                "destroy_snapshot_group", "create_snapshot_group",
                "get_authorized_ids"
            ])
            self.create_volume = mock.Mock(return_value={
                "mount_path": "/foo/bar"
            })
            self.get_mon_addrs = mock.Mock(return_value=["1.2.3.4", "5.6.7.8"])
            self.get_authorized_ids = mock.Mock(
                return_value=[('eve', 'rw')])
            self.authorize = mock.Mock(return_value={"auth_key": "abc123"})
            self.get_used_bytes = mock.Mock(return_value=self.mock_used_bytes)
            self.rados = mock.Mock()
            self.rados.get_cluster_stats = mock.Mock(return_value={
                "kb": 1000,
                "kb_avail": 500
            })