mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-03 23:18:40 +00:00
[Tests] Remove duplicated override code
This commit is contained in:
parent
15e0e0f30a
commit
29191e6a58
1 changed files with 1 additions and 24 deletions
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from twisted.internet import reactor
|
|
||||||
|
|
||||||
import deluge.common
|
import deluge.common
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.ui.web.auth
|
import deluge.ui.web.auth
|
||||||
|
@ -19,31 +17,10 @@ from deluge import configmanager
|
||||||
from deluge.ui.web.server import DelugeWeb
|
from deluge.ui.web.server import DelugeWeb
|
||||||
|
|
||||||
from .basetest import BaseTestCase
|
from .basetest import BaseTestCase
|
||||||
|
from .common import ReactorOverride
|
||||||
from .daemon_base import DaemonBase
|
from .daemon_base import DaemonBase
|
||||||
|
|
||||||
|
|
||||||
class ReactorOverride(object):
|
|
||||||
"""
|
|
||||||
Class used to to mock the reactor
|
|
||||||
|
|
||||||
During unit tests, the reactor must not be touched, so for code that
|
|
||||||
explicitly calls the reactor, we use a mock.
|
|
||||||
|
|
||||||
"""
|
|
||||||
def __getattr__(self, attr):
|
|
||||||
if attr == 'run':
|
|
||||||
return self._run
|
|
||||||
if attr == 'stop':
|
|
||||||
return self._stop
|
|
||||||
return getattr(reactor, attr)
|
|
||||||
|
|
||||||
def _run(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def _stop(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
class WebServerTestBase(BaseTestCase, DaemonBase):
|
class WebServerTestBase(BaseTestCase, DaemonBase):
|
||||||
"""
|
"""
|
||||||
Base class for tests that need a running webapi
|
Base class for tests that need a running webapi
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue