本文整理汇总了Python中mock.Mock.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Mock.__init__方法的具体用法?Python Mock.__init__怎么用?Python Mock.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mock.Mock
的用法示例。
在下文中一共展示了Mock.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
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
示例2: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args=None, content=""):
Mock.__init__(self, spec=server.Request)
if args is None:
args = {}
self.args = args
self.content = StringIO(content)
self.site = Mock(spec=server.Site)
webstatus = baseweb.WebStatus(site=self.site)
self.site.buildbot_service = webstatus
self.uri = "/"
self.prepath = []
self.method = "GET"
self.received_headers = {}
master = webstatus.master = fakemaster.make_master()
webstatus.setUpJinja2()
self.addedChanges = []
def addChange(**kwargs):
self.addedChanges.append(kwargs)
return defer.succeed(Mock())
master.addChange = addChange
self.deferred = defer.Deferred()
示例3: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args={}):
self.args = args
self.site = Mock()
self.site.buildbot_service = Mock()
self.site.buildbot_service.master = Mock()
self.site.buildbot_service.master.change_svc = Mock()
Mock.__init__(self)
示例4: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, addr, s=None):
logging.info("initializing connector")
global connector_cpt
self.desc = connector_cpt
connector_cpt += 1
self.packet_cpt = 0
self.addr = addr
Mock.__init__(self)
示例5: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args={}):
self.args = args
self.site = Mock()
self.site.buildbot_service = Mock()
master = self.site.buildbot_service.master = Mock()
self.addedChanges = []
def addChange(**kwargs):
self.addedChanges.append(kwargs)
return defer.succeed(Mock())
master.addChange = addChange
Mock.__init__(self)
示例6: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args=None, content=''):
Mock.__init__(self)
if args is None:
args = {}
self.args = args
self.content = StringIO(content)
self.site = Mock()
self.site.buildbot_service = Mock()
self.uri = '/'
self.prepath = []
self.method = 'GET'
self.received_headers = {}
self.deferred = defer.Deferred()
示例7: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args={}, content=''):
Mock.__init__(self)
self.args = args
self.content = StringIO(content)
self.site = Mock()
self.site.buildbot_service = Mock()
master = self.site.buildbot_service.master = Mock()
self.addedChanges = []
def addChange(**kwargs):
self.addedChanges.append(kwargs)
return defer.succeed(Mock())
master.addChange = addChange
self.deferred = defer.Deferred()
示例8: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, args={}, content=''):
Mock.__init__(self)
self.args = args
self.content = StringIO(content)
self.site = Mock()
self.site.buildbot_service = Mock()
master = self.site.buildbot_service.master = Mock()
self.uri = '/'
self.prepath = []
self.method = 'GET'
self.received_headers = {}
self.addedChanges = []
def addChange(**kwargs):
self.addedChanges.append(kwargs)
return defer.succeed(Mock())
master.addChange = addChange
self.deferred = defer.Deferred()
示例9: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
class MockedSupvisors:
""" Simple supvisors with all dummies. """
def __init__(self):
# use a dummy address mapper and options
self.address_mapper = DummyAddressMapper()
self.options = DummyOptions()
# mock the context
from supvisors.context import Context
self.context = Mock(spec=Context)
self.context.__init__()
self.context.addresses = {}
self.context.applications = {}
# simple mocks
self.fsm = Mock()
self.pool = Mock()
self.requester = Mock()
self.statistician = Mock()
self.failure_handler = Mock()
# mock the supervisord source
from supvisors.infosource import SupervisordSource
self.info_source = Mock(spec=SupervisordSource)
self.info_source.get_env.return_value = {
'SUPERVISOR_SERVER_URL': 'http://127.0.0.1:65000',
'SUPERVISOR_USERNAME': '',
'SUPERVISOR_PASSWORD': ''}
# mock by spec
from supvisors.listener import SupervisorListener
self.listener = Mock(spec=SupervisorListener)
self.logger = Mock(spec=Logger)
from supvisors.sparser import Parser
self.parser = Mock(spec=Parser)
from supvisors.commander import Starter, Stopper
self.starter = Mock(spec=Starter)
self.stopper = Mock(spec=Stopper)
from supvisors.supvisorszmq import SupvisorsZmq
self.zmq = Mock(spec=SupvisorsZmq)
self.zmq.__init__()
示例10: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, *args):
Mock.__init__(self, *args)
示例11: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Mock.__init__(self, *args, **kwargs)
self.builder = None
self.properites = {}
示例12: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self):
Mock.__init__(self)
示例13: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, *args, **kwargs):
Mock.__init__(self)
if kwargs.get("retries"):
self.tries = kwargs["retries"]
else:
self.tries = 1
示例14: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, *args, **kwargs):
self.value = None
Mock.__init__(self)
示例15: __init__
# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
def __init__(self, *args):
self.connect_succeeded = True
IdleMock.__init__(self)
Mock.__init__(self, *args)