def test_send_quit_disconnected(): bot = BotCollector() backend = MockIRCBackend(bot) backend.connected = False # TODO: refactor without attribute backend.send_quit() backend.send_quit(reason='Bye freenode!') assert backend.message_sent == [] assert bot.message_sent == []
def test_send_quit_text(): bot = BotCollector() backend = MockIRCBackend(bot) backend.connected = True # TODO: refactor without attribute backend.send_quit(reason='Bye freenode!') expected = 'QUIT :Bye freenode!\r\n' assert backend.message_sent == [expected.encode('utf-8')] assert bot.message_sent == [expected]