summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_torrent.py
diff options
context:
space:
mode:
authorCalum Lind <calumlind@gmail.com>2018-11-02 11:51:43 +0000
committerCalum Lind <calumlind@gmail.com>2018-11-05 08:26:23 +0000
commit6655fe67c3728833e92152b216da89a211e28c0c (patch)
treee60a2a1caa43c3f4fed7e619a466355ea7b2ec02 /deluge/tests/test_torrent.py
parent2104b9831c08d53ea27b80ca98deb923f04e1e9d (diff)
downloaddeluge-6655fe67c3728833e92152b216da89a211e28c0c.tar.gz
deluge-6655fe67c3728833e92152b216da89a211e28c0c.tar.bz2
deluge-6655fe67c3728833e92152b216da89a211e28c0c.zip
[UI|Core] Fix problems with file priorities
- Fixed the core not correctly settings the current file_priority settings and added a test. - Fixed the console not setting file priorities. - Change the label for not downloading of a file to 'Skip'.
Diffstat (limited to 'deluge/tests/test_torrent.py')
-rw-r--r--deluge/tests/test_torrent.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py
index ef5ecba1f..43d355bba 100644
--- a/deluge/tests/test_torrent.py
+++ b/deluge/tests/test_torrent.py
@@ -44,6 +44,7 @@ class TorrentTestCase(BaseTestCase):
self.rpcserver = RPCServer(listen=False)
self.core = Core()
self.core.config.config['lsd'] = False
+ self.core.config.config['new_release_check'] = False
self.session = self.core.session
self.torrent = None
return component.start()
@@ -80,6 +81,25 @@ class TorrentTestCase(BaseTestCase):
atp['duplicate_is_error'] = True
return atp
+ def test_set_file_priorities(self):
+ atp = self.get_torrent_atp('dir_with_6_files.torrent')
+ handle = self.session.add_torrent(atp)
+ torrent = Torrent(handle, {})
+
+ result = torrent.get_file_priorities()
+ self.assertTrue(all(x == 4 for x in result))
+
+ new_priorities = [3, 1, 2, 0, 5, 6, 7]
+ torrent.set_file_priorities(new_priorities)
+ self.assertEqual(torrent.get_file_priorities(), new_priorities)
+
+ # Test with handle.piece_priorities as handle.file_priorities async
+ # updates and will return old value. Also need to remove a priority
+ # value as one file is much smaller than piece size so doesn't show.
+ piece_prio = handle.piece_priorities()
+ result = all(p in piece_prio for p in [3, 2, 0, 5, 6, 7])
+ self.assertTrue(result)
+
def test_set_prioritize_first_last_pieces(self):
piece_indexes = [
0,