当前位置: 首页>>代码示例>>Python>>正文


Python Mock.__init__方法代码示例

本文整理汇总了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
开发者ID:kevin-teddy,项目名称:gajim,代码行数:35,代码来源:mocks.py

示例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()
开发者ID:edunham,项目名称:buildbot,代码行数:30,代码来源:web.py

示例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)
开发者ID:cread,项目名称:buildbot,代码行数:9,代码来源:web.py

示例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)
开发者ID:Nexedi,项目名称:neoppod,代码行数:10,代码来源:testConnection.py

示例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)
开发者ID:Callek,项目名称:buildbot,代码行数:15,代码来源:web.py

示例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()
开发者ID:dankegel,项目名称:buildbot-x,代码行数:17,代码来源:web.py

示例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()
开发者ID:mihaimartalogu,项目名称:buildbot,代码行数:18,代码来源:web.py

示例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()
开发者ID:davebx,项目名称:buildbot,代码行数:23,代码来源:web.py

示例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__()
开发者ID:julien6387,项目名称:supervisors,代码行数:39,代码来源:base.py

示例10: __init__

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
	def __init__(self, *args):
		Mock.__init__(self, *args)
开发者ID:kevin-teddy,项目名称:gajim,代码行数:4,代码来源:test_caps.py

示例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 = {}
开发者ID:bobbyi,项目名称:buildbot,代码行数:6,代码来源:test_status_mail.py

示例12: __init__

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
 def __init__(self):
       Mock.__init__(self)
开发者ID:kalkin,项目名称:gajim,代码行数:4,代码来源:test_socks5.py

示例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
开发者ID:LabAdvComp,项目名称:dish,代码行数:8,代码来源:utils.py

示例14: __init__

# 需要导入模块: from mock import Mock [as 别名]
# 或者: from mock.Mock import __init__ [as 别名]
 def __init__(self, *args, **kwargs):
     self.value = None
     Mock.__init__(self)
开发者ID:BackupTheBerlios,项目名称:wxoptparse-svn,代码行数:5,代码来源:wxMock.py

示例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)
开发者ID:gajim,项目名称:python-nbxmpp,代码行数:6,代码来源:xmpp_mocks.py


注:本文中的mock.Mock.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。