mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-22 08:08:17 +00:00
This should fix problems with errors occuring when failing to enable plugins. Errors in plugin handling are handled better and properly logged. WebUI plugin in particular had issues when being enabled and disabled multiple times because it was trying to create DelugeWeb component each time it was enabled. If deluge-web is already listening on the same port, enabling the WebUI plugin will fail, and the checkbox will not be checked. There are still some issues when enabling/disabling plugins by clicking fast multiple times on the checkbox.
38 lines
1.1 KiB
Python
38 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
#
|
|
# This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with
|
|
# the additional special exception to link portions of this program with the OpenSSL library.
|
|
# See LICENSE for more details.
|
|
#
|
|
|
|
import deluge.component as component
|
|
from deluge.core.core import Core
|
|
|
|
from .basetest import BaseTestCase
|
|
|
|
|
|
class AlertManagerTestCase(BaseTestCase):
|
|
|
|
def set_up(self):
|
|
self.core = Core()
|
|
self.am = component.get("AlertManager")
|
|
return component.start(["AlertManager"])
|
|
|
|
def tear_down(self):
|
|
return component.shutdown()
|
|
|
|
def test_register_handler(self):
|
|
def handler(alert):
|
|
return
|
|
|
|
self.am.register_handler("dummy_alert", handler)
|
|
self.assertEquals(self.am.handlers["dummy_alert"], [handler])
|
|
|
|
def test_deregister_handler(self):
|
|
def handler(alert):
|
|
return
|
|
|
|
self.am.register_handler("dummy_alert", handler)
|
|
self.am.deregister_handler(handler)
|
|
self.assertEquals(self.am.handlers["dummy_alert"], [])
|