Fixed tests: sessionproxy/torrent/tracker_icon
* Fixed sessionproxy tests * Fixed test_torrent messing up component for other tests * Updated tracker_icon test to use unresized google icon
This commit is contained in:
parent
607be461e0
commit
a60dc95fed
Binary file not shown.
After Width: | Height: | Size: 5.3 KiB |
Binary file not shown.
Before Width: | Height: | Size: 640 B |
|
@ -87,6 +87,14 @@ class SessionProxyTestCase(unittest.TestCase):
|
|||
self.sp = deluge.ui.sessionproxy.SessionProxy()
|
||||
client.core.reset()
|
||||
d = self.sp.start()
|
||||
|
||||
def do_get_torrents_status(torrent_ids):
|
||||
inital_keys = [
|
||||
'queue', 'state', 'name', 'total_wanted', 'progress', 'state',
|
||||
'download_payload_rate', 'upload_payload_rate', 'eta', 'owner'
|
||||
]
|
||||
self.sp.get_torrents_status({'id': torrent_ids}, inital_keys)
|
||||
d.addCallback(do_get_torrents_status)
|
||||
return d
|
||||
|
||||
def tearDown(self):
|
||||
|
|
|
@ -7,8 +7,6 @@ import common
|
|||
from deluge.core.rpcserver import RPCServer
|
||||
from deluge.core.core import Core
|
||||
|
||||
deluge.core.torrent.component = test_torrent
|
||||
|
||||
from deluge._libtorrent import lt
|
||||
|
||||
import deluge.component as component
|
||||
|
@ -37,6 +35,9 @@ class TorrentTestCase(unittest.TestCase):
|
|||
core_config.save()
|
||||
|
||||
def setUp(self):
|
||||
# Save component and set back on teardown
|
||||
self.original_component = deluge.core.torrent.component
|
||||
deluge.core.torrent.component = test_torrent
|
||||
self.setup_config()
|
||||
global rpcserver
|
||||
global core
|
||||
|
@ -50,6 +51,7 @@ class TorrentTestCase(unittest.TestCase):
|
|||
if self.torrent:
|
||||
self.torrent.prev_status_cleanup_loop.stop()
|
||||
|
||||
deluge.core.torrent.component = self.original_component
|
||||
def on_shutdown(result):
|
||||
component._ComponentRegistry.components = {}
|
||||
return component.shutdown().addCallback(on_shutdown)
|
||||
|
|
|
@ -11,6 +11,9 @@ icons = TrackerIcons()
|
|||
|
||||
dirname = os.path.dirname(__file__)
|
||||
|
||||
import deluge.ui.tracker_icons
|
||||
deluge.ui.tracker_icons.PIL_INSTALLED = False
|
||||
|
||||
class TrackerIconsTestCase(unittest.TestCase):
|
||||
|
||||
def test_get_deluge_png(self):
|
||||
|
@ -24,7 +27,7 @@ class TrackerIconsTestCase(unittest.TestCase):
|
|||
def test_get_google_ico(self):
|
||||
# Google doesn't have any icon links
|
||||
# So instead we'll grab its favicon.ico
|
||||
icon = TrackerIcon(os.path.join(dirname, "google.png"))
|
||||
icon = TrackerIcon(os.path.join(dirname, "google.ico"))
|
||||
d = icons.get("www.google.com")
|
||||
d.addCallback(self.assertNotIdentical, None)
|
||||
d.addCallback(self.assertEquals, icon)
|
||||
|
@ -32,7 +35,7 @@ class TrackerIconsTestCase(unittest.TestCase):
|
|||
|
||||
def test_get_google_ico_with_redirect(self):
|
||||
# google.com redirects to www.google.com
|
||||
icon = TrackerIcon(os.path.join(dirname, "google.png"))
|
||||
icon = TrackerIcon(os.path.join(dirname, "google.ico"))
|
||||
d = icons.get("google.com")
|
||||
d.addCallback(self.assertNotIdentical, None)
|
||||
d.addCallback(self.assertEquals, icon)
|
||||
|
|
|
@ -76,6 +76,7 @@ class SessionProxy(component.Component):
|
|||
# so that upcoming queries or status updates don't throw errors.
|
||||
self.torrents.setdefault(torrent_id, [time.time(), {}])
|
||||
self.cache_times.setdefault(torrent_id, {})
|
||||
return torrent_ids
|
||||
return client.core.get_session_state().addCallback(on_get_session_state)
|
||||
|
||||
def stop(self):
|
||||
|
|
Loading…
Reference in New Issue