def __init__(self, **config): self.check_required() loop = MagicMock() loop.call_later = call_later loop.call_soon = call_soon loop.time = MagicMock() loop.time.return_value = 10 config.update(testing=True, async=False, level=1000, loop=loop) super(IrcBot, self).__init__(**config) self.protocol = irc3.IrcConnection() self.protocol.factory = self self.protocol.transport = MagicMock() self.protocol.write = MagicMock()
def __init__(self, **config): self.check_required() if 'loop' not in config: loop = asyncio.new_event_loop() loop = mock.create_autospec(loop, spec_set=True) loop.call_later = call_later loop.call_soon = call_soon loop.time.return_value = 10 config.update(testing=True, async=False, level=1000, loop=loop) else: config.update(testing=True, level=1000) super(IrcBot, self).__init__(**config) self.protocol = irc3.IrcConnection() self.protocol.closed = False self.protocol.factory = self self.protocol.transport = MagicMock() self.protocol.write = MagicMock()
def callFTU(self): conn = irc3.IrcConnection() conn.encoding = 'utf8' conn.factory = MagicMock() conn.connection_made(MagicMock()) return conn
def irc_conn(request): irc_conn = irc3.IrcConnection() irc_conn.encoding = 'utf8' irc_conn.factory = MagicMock() irc_conn.connection_made(MagicMock()) return irc_conn