Esempio n. 1
0
def test_load_webserver(_, monkeypatch):
    monkeypatch.setattr("chitanda.bot.config", {"webserver": {"enable": True}})
    with patch.object(Chitanda, "_start_webserver"):
        with patch.object(Chitanda, "connect"):
            chitanda = Chitanda()
            chitanda.start()
            assert chitanda.webserver is not None
Esempio n. 2
0
def test_load_webserver(_, monkeypatch):
    monkeypatch.setattr('chitanda.bot.config', {'webserver': {'enable': True}})
    with patch.object(Chitanda, '_start_webserver'):
        with patch.object(Chitanda, 'connect'):
            chitanda = Chitanda()
            chitanda.start()
            assert chitanda.webserver is not None
Esempio n. 3
0
def test_dont_load_webserver(_, monkeypatch):
    monkeypatch.setattr("chitanda.bot.config",
                        {"webserver": {
                            "enable": False
                        }})
    with patch.object(Chitanda, "_start_webserver"):
        with patch.object(Chitanda, "connect"):
            chitanda = Chitanda()
            chitanda.start()
            assert not hasattr(chitanda, "webserver")
Esempio n. 4
0
def test_dont_load_webserver(_, monkeypatch):
    monkeypatch.setattr('chitanda.bot.config',
                        {'webserver': {
                            'enable': False
                        }})
    with patch.object(Chitanda, '_start_webserver'):
        with patch.object(Chitanda, 'connect'):
            chitanda = Chitanda()
            chitanda.start()
            assert not hasattr(chitanda, 'webserver')
Esempio n. 5
0
def run():
    """Run the bot."""
    bot = Chitanda()
    bot.start()
    asyncio.get_event_loop().run_forever()