summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_lightweigh_cleaning.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/test_lightweigh_cleaning.py b/tests/test_lightweigh_cleaning.py
index 7af31ad..5fd7ad6 100644
--- a/tests/test_lightweigh_cleaning.py
+++ b/tests/test_lightweigh_cleaning.py
@@ -4,7 +4,7 @@ import unittest
4import shutil 4import shutil
5import os 5import os
6 6
7from libmat2 import pdf, images 7from libmat2 import pdf, images, torrent
8 8
9class TestLightWeightCleaning(unittest.TestCase): 9class TestLightWeightCleaning(unittest.TestCase):
10 def test_pdf(self): 10 def test_pdf(self):
@@ -63,3 +63,20 @@ class TestLightWeightCleaning(unittest.TestCase):
63 63
64 os.remove('./tests/data/clean.jpg') 64 os.remove('./tests/data/clean.jpg')
65 os.remove('./tests/data/clean.cleaned.jpg') 65 os.remove('./tests/data/clean.cleaned.jpg')
66
67 def test_torrent(self):
68 shutil.copy('./tests/data/dirty.torrent', './tests/data/clean.torrent')
69 p = torrent.TorrentParser('./tests/data/clean.torrent')
70
71 meta = p.get_meta()
72 self.assertEqual(meta['created by'], b'mktorrent 1.0')
73
74 p.lightweight_cleaning = True
75 ret = p.remove_all()
76 self.assertTrue(ret)
77
78 p = torrent.TorrentParser('./tests/data/clean.cleaned.torrent')
79 self.assertEqual(p.get_meta(), {})
80
81 os.remove('./tests/data/clean.torrent')
82 os.remove('./tests/data/clean.cleaned.torrent')