summaryrefslogtreecommitdiffstats
path: root/deluge/tests/test_ui_common.py
diff options
context:
space:
mode:
Diffstat (limited to 'deluge/tests/test_ui_common.py')
-rw-r--r--deluge/tests/test_ui_common.py42
1 files changed, 14 insertions, 28 deletions
diff --git a/deluge/tests/test_ui_common.py b/deluge/tests/test_ui_common.py
index b0c311183..ee97259de 100644
--- a/deluge/tests/test_ui_common.py
+++ b/deluge/tests/test_ui_common.py
@@ -1,4 +1,3 @@
-# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 bendikro <bro.devel+deluge@gmail.com>
#
@@ -6,30 +5,19 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-from six import assertCountEqual
-from twisted.trial import unittest
-
-from deluge.common import windows_check
from deluge.ui.common import TorrentInfo
from . import common
-class UICommonTestCase(unittest.TestCase):
- def setUp(self): # NOQA: N803
- pass
-
- def tearDown(self): # NOQA: N803
- pass
-
+class TestUICommon:
def test_hash_optional_single_file(self):
"""Ensure single file with `ed2k` and `sha1` keys are not in filetree output."""
filename = common.get_test_data_file('test.torrent')
files_tree = {'azcvsupdater_2.6.2.jar': (0, 307949, True)}
ti = TorrentInfo(filename, filetree=1)
- self.assertEqual(ti.files_tree, files_tree)
+ assert ti.files_tree == files_tree
files_tree2 = {
'contents': {
@@ -42,7 +30,7 @@ class UICommonTestCase(unittest.TestCase):
}
}
ti = TorrentInfo(filename, filetree=2)
- self.assertEqual(ti.files_tree, files_tree2)
+ assert ti.files_tree == files_tree2
def test_hash_optional_multi_file(self):
"""Ensure multi-file with `filehash` and `ed2k` are keys not in filetree output."""
@@ -54,7 +42,7 @@ class UICommonTestCase(unittest.TestCase):
}
}
ti = TorrentInfo(filename, filetree=1)
- self.assertEqual(ti.files_tree, files_tree)
+ assert ti.files_tree == files_tree
filestree2 = {
'contents': {
@@ -83,14 +71,14 @@ class UICommonTestCase(unittest.TestCase):
'type': 'dir',
}
ti = TorrentInfo(filename, filetree=2)
- self.assertEqual(ti.files_tree, filestree2)
+ assert ti.files_tree == filestree2
def test_hash_optional_md5sum(self):
# Ensure `md5sum` key is not included in filetree output
filename = common.get_test_data_file('md5sum.torrent')
files_tree = {'test': {'lol': (0, 4, True), 'rofl': (1, 5, True)}}
ti = TorrentInfo(filename, filetree=1)
- self.assertEqual(ti.files_tree, files_tree)
+ assert ti.files_tree == files_tree
ti = TorrentInfo(filename, filetree=2)
files_tree2 = {
'contents': {
@@ -118,16 +106,14 @@ class UICommonTestCase(unittest.TestCase):
},
'type': 'dir',
}
- self.assertEqual(ti.files_tree, files_tree2)
+ assert ti.files_tree == files_tree2
def test_utf8_encoded_paths(self):
filename = common.get_test_data_file('test.torrent')
ti = TorrentInfo(filename)
- self.assertTrue('azcvsupdater_2.6.2.jar' in ti.files_tree)
+ assert 'azcvsupdater_2.6.2.jar' in ti.files_tree
def test_utf8_encoded_paths2(self):
- if windows_check():
- raise unittest.SkipTest('on windows KeyError: unicode_filenames')
filename = common.get_test_data_file('unicode_filenames.torrent')
filepath1 = '\u30c6\u30af\u30b9\u30fb\u30c6\u30af\u30b5\u30f3.mkv'
filepath2 = (
@@ -140,11 +126,11 @@ class UICommonTestCase(unittest.TestCase):
ti = TorrentInfo(filename)
files_tree = ti.files_tree['unicode_filenames']
- self.assertIn(filepath1, files_tree)
- self.assertIn(filepath2, files_tree)
- self.assertIn(filepath3, files_tree)
- self.assertIn(filepath4, files_tree)
- self.assertIn(filepath5, files_tree)
+ assert filepath1 in files_tree
+ assert filepath2 in files_tree
+ assert filepath3 in files_tree
+ assert filepath4 in files_tree
+ assert filepath5 in files_tree
result_files = [
{
@@ -170,4 +156,4 @@ class UICommonTestCase(unittest.TestCase):
{'download': True, 'path': 'unicode_filenames/' + filepath1, 'size': 1771},
]
- assertCountEqual(self, ti.files, result_files)
+ assert len(ti.files) == len(result_files)