[Tests] Change example files in files tab test to sort the same on linux/windows

This commit is contained in:
Chase Sterling 2022-01-26 00:03:12 -05:00 committed by Calum Lind
parent a41f950d09
commit 23f7c4dd6e
No known key found for this signature in database
GPG Key ID: 90597A687B836BA3
1 changed files with 16 additions and 23 deletions

View File

@ -8,7 +8,6 @@ import pytest
from twisted.trial import unittest from twisted.trial import unittest
import deluge.component as component import deluge.component as component
from deluge.common import windows_check
from deluge.configmanager import ConfigManager from deluge.configmanager import ConfigManager
from deluge.i18n import setup_translation from deluge.i18n import setup_translation
@ -98,39 +97,35 @@ class FilesTabTestCase(BaseTestCase):
self.assertTrue(ret) self.assertTrue(ret)
def test_files_tab2(self): def test_files_tab2(self):
if windows_check():
raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = ( self.filestab.files_list[self.t_id] = (
{'index': 0, 'path': '1/1/test_10.txt', 'offset': 0, 'size': 13}, {'index': 0, 'path': '1/1/test_100.txt', 'offset': 0, 'size': 13},
{'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14}, {'index': 1, 'path': 'test_101.txt', 'offset': 13, 'size': 14},
) )
self.filestab.update_files() self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event( self.filestab._on_torrentfilerenamed_event(
self.t_id, self.index, '1/1/test_100.txt' self.t_id, self.index, '1/1/test_101.txt'
) )
ret = self.verify_treestore( ret = self.verify_treestore(
self.filestab.treestore, self.filestab.treestore,
[['1/', [['1/', [['test_100.txt'], ['test_10.txt']]]]]], [['1/', [['1/', [['test_100.txt'], ['test_101.txt']]]]]],
) )
if not ret: if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore) self.print_treestore('Treestore not expected:', self.filestab.treestore)
self.assertTrue(ret) self.assertTrue(ret)
def test_files_tab3(self): def test_files_tab3(self):
if windows_check():
raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = ( self.filestab.files_list[self.t_id] = (
{'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
{'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14}, {'index': 1, 'path': 'test_101.txt', 'offset': 13, 'size': 14},
) )
self.filestab.update_files() self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event( self.filestab._on_torrentfilerenamed_event(
self.t_id, self.index, '1/test_100.txt' self.t_id, self.index, '1/test_101.txt'
) )
ret = self.verify_treestore( ret = self.verify_treestore(
self.filestab.treestore, [['1/', [['test_100.txt'], ['test_10.txt']]]] self.filestab.treestore, [['1/', [['test_100.txt'], ['test_101.txt']]]]
) )
if not ret: if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore) self.print_treestore('Treestore not expected:', self.filestab.treestore)
@ -138,36 +133,34 @@ class FilesTabTestCase(BaseTestCase):
def test_files_tab4(self): def test_files_tab4(self):
self.filestab.files_list[self.t_id] = ( self.filestab.files_list[self.t_id] = (
{'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
{'index': 1, 'path': '1/test_100.txt', 'offset': 13, 'size': 14}, {'index': 1, 'path': '1/test_101.txt', 'offset': 13, 'size': 14},
) )
self.filestab.update_files() self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event( self.filestab._on_torrentfilerenamed_event(
self.t_id, self.index, '1/2/test_100.txt' self.t_id, self.index, '1/2/test_101.txt'
) )
ret = self.verify_treestore( ret = self.verify_treestore(
self.filestab.treestore, self.filestab.treestore,
[['1/', [['2/', [['test_100.txt']]], ['test_10.txt']]]], [['1/', [['2/', [['test_101.txt']]], ['test_100.txt']]]],
) )
if not ret: if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore) self.print_treestore('Treestore not expected:', self.filestab.treestore)
self.assertTrue(ret) self.assertTrue(ret)
def test_files_tab5(self): def test_files_tab5(self):
if windows_check():
raise unittest.SkipTest('on windows \\ != / for path names')
self.filestab.files_list[self.t_id] = ( self.filestab.files_list[self.t_id] = (
{'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, {'index': 0, 'path': '1/test_100.txt', 'offset': 0, 'size': 13},
{'index': 1, 'path': '2/test_100.txt', 'offset': 13, 'size': 14}, {'index': 1, 'path': '2/test_101.txt', 'offset': 13, 'size': 14},
) )
self.filestab.update_files() self.filestab.update_files()
self.filestab._on_torrentfilerenamed_event( self.filestab._on_torrentfilerenamed_event(
self.t_id, self.index, '1/test_100.txt' self.t_id, self.index, '1/test_101.txt'
) )
ret = self.verify_treestore( ret = self.verify_treestore(
self.filestab.treestore, [['1/', [['test_100.txt'], ['test_10.txt']]]] self.filestab.treestore, [['1/', [['test_100.txt'], ['test_101.txt']]]]
) )
if not ret: if not ret:
self.print_treestore('Treestore not expected:', self.filestab.treestore) self.print_treestore('Treestore not expected:', self.filestab.treestore)