summaryrefslogtreecommitdiff
path: root/tests/test_libmat2.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_libmat2.py')
-rw-r--r--tests/test_libmat2.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index 3d08dea..7deeadc 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -57,6 +57,20 @@ class TestCorruptedFiles(unittest.TestCase):
57 images.PNGParser('./tests/data/clean.pdf') 57 images.PNGParser('./tests/data/clean.pdf')
58 os.remove('./tests/data/clean.pdf') 58 os.remove('./tests/data/clean.pdf')
59 59
60 def test_torrent(self):
61 shutil.copy('./tests/data/dirty.png', './tests/data/clean.torrent')
62 p = torrent.TorrentParser('./tests/data/clean.torrent')
63 self.assertFalse(p.remove_all())
64 expected = {'Unknown meta': 'Unable to parse torrent file "./tests/data/clean.torrent".'}
65 self.assertEqual(p.get_meta(), expected)
66
67 with open("./tests/data/clean.torrent", "a") as f:
68 f.write("trailing garbage")
69 p = torrent.TorrentParser('./tests/data/clean.torrent')
70 self.assertEqual(p.get_meta(), expected)
71
72 os.remove('./tests/data/clean.torrent')
73
60class TestGetMeta(unittest.TestCase): 74class TestGetMeta(unittest.TestCase):
61 def test_pdf(self): 75 def test_pdf(self):
62 p = pdf.PDFParser('./tests/data/dirty.pdf') 76 p = pdf.PDFParser('./tests/data/dirty.pdf')