summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorjvoisin2018-09-24 19:50:24 +0200
committerjvoisin2018-09-24 19:50:24 +0200
commit2e243355f51654c8c6392c80a17b090f9f012fd1 (patch)
treeb4bb244443ab0566cdb741b1c91a112ff8149214 /tests
parent174d4a0ac09c2e9d4a9aa3677a442c05459b8309 (diff)
Fix some minor formatting issues
Diffstat (limited to 'tests')
-rw-r--r--tests/test_climat2.py1
-rw-r--r--tests/test_corrupted_files.py16
-rw-r--r--tests/test_deep_cleaning.py2
-rw-r--r--tests/test_libmat2.py2
-rw-r--r--tests/test_policy.py1
5 files changed, 12 insertions, 10 deletions
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index a94fc23..b84afdf 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -77,7 +77,6 @@ class TestCleanFolder(unittest.TestCase):
77 shutil.rmtree('./tests/data/folder/') 77 shutil.rmtree('./tests/data/folder/')
78 78
79 79
80
81class TestCleanMeta(unittest.TestCase): 80class TestCleanMeta(unittest.TestCase):
82 def test_jpg(self): 81 def test_jpg(self):
83 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg') 82 shutil.copy('./tests/data/dirty.jpg', './tests/data/clean.jpg')
diff --git a/tests/test_corrupted_files.py b/tests/test_corrupted_files.py
index 72d124f..aee1530 100644
--- a/tests/test_corrupted_files.py
+++ b/tests/test_corrupted_files.py
@@ -53,16 +53,21 @@ class TestUnsupportedFiles(unittest.TestCase):
53class TestCorruptedEmbedded(unittest.TestCase): 53class TestCorruptedEmbedded(unittest.TestCase):
54 def test_docx(self): 54 def test_docx(self):
55 shutil.copy('./tests/data/embedded_corrupted.docx', './tests/data/clean.docx') 55 shutil.copy('./tests/data/embedded_corrupted.docx', './tests/data/clean.docx')
56 parser, mimetype = parser_factory.get_parser('./tests/data/clean.docx') 56 parser, _ = parser_factory.get_parser('./tests/data/clean.docx')
57 self.assertFalse(parser.remove_all()) 57 self.assertFalse(parser.remove_all())
58 self.assertIsNotNone(parser.get_meta()) 58 self.assertIsNotNone(parser.get_meta())
59 os.remove('./tests/data/clean.docx') 59 os.remove('./tests/data/clean.docx')
60 60
61 def test_odt(self): 61 def test_odt(self):
62 expected = {
63 'create_system': 'Weird',
64 'date_time': '2018-06-10 17:18:18',
65 'meta.xml': 'harmful content'
66 }
62 shutil.copy('./tests/data/embedded_corrupted.odt', './tests/data/clean.odt') 67 shutil.copy('./tests/data/embedded_corrupted.odt', './tests/data/clean.odt')
63 parser, mimetype = parser_factory.get_parser('./tests/data/clean.odt') 68 parser, _ = parser_factory.get_parser('./tests/data/clean.odt')
64 self.assertFalse(parser.remove_all()) 69 self.assertFalse(parser.remove_all())
65 self.assertEqual(parser.get_meta(), {'create_system': 'Weird', 'date_time': '2018-06-10 17:18:18', 'meta.xml': 'harmful content'}) 70 self.assertEqual(parser.get_meta(), expected)
66 os.remove('./tests/data/clean.odt') 71 os.remove('./tests/data/clean.odt')
67 72
68 73
@@ -90,7 +95,7 @@ class TestCorruptedFiles(unittest.TestCase):
90 95
91 def test_png2(self): 96 def test_png2(self):
92 shutil.copy('./tests/test_libmat2.py', './tests/clean.png') 97 shutil.copy('./tests/test_libmat2.py', './tests/clean.png')
93 parser, mimetype = parser_factory.get_parser('./tests/clean.png') 98 parser, _ = parser_factory.get_parser('./tests/clean.png')
94 self.assertIsNone(parser) 99 self.assertIsNone(parser)
95 os.remove('./tests/clean.png') 100 os.remove('./tests/clean.png')
96 101
@@ -134,7 +139,8 @@ class TestCorruptedFiles(unittest.TestCase):
134 139
135 def test_bmp(self): 140 def test_bmp(self):
136 shutil.copy('./tests/data/dirty.png', './tests/data/clean.bmp') 141 shutil.copy('./tests/data/dirty.png', './tests/data/clean.bmp')
137 harmless.HarmlessParser('./tests/data/clean.bmp') 142 ret = harmless.HarmlessParser('./tests/data/clean.bmp')
143 self.assertIsNotNone(ret)
138 os.remove('./tests/data/clean.bmp') 144 os.remove('./tests/data/clean.bmp')
139 145
140 def test_docx(self): 146 def test_docx(self):
diff --git a/tests/test_deep_cleaning.py b/tests/test_deep_cleaning.py
index 82579a3..4f1920d 100644
--- a/tests/test_deep_cleaning.py
+++ b/tests/test_deep_cleaning.py
@@ -23,7 +23,6 @@ class TestZipMetadata(unittest.TestCase):
23 self.assertEqual(inside_p.get_meta(), {}) 23 self.assertEqual(inside_p.get_meta(), {})
24 shutil.rmtree(tempdir) 24 shutil.rmtree(tempdir)
25 25
26
27 def __check_zip_meta(self, p): 26 def __check_zip_meta(self, p):
28 zipin = zipfile.ZipFile(p.filename) 27 zipin = zipfile.ZipFile(p.filename)
29 for item in zipin.infolist(): 28 for item in zipin.infolist():
@@ -135,4 +134,3 @@ class TestRsidRemoval(unittest.TestCase):
135 134
136 os.remove('./tests/data/clean.docx') 135 os.remove('./tests/data/clean.docx')
137 os.remove('./tests/data/clean.cleaned.docx') 136 os.remove('./tests/data/clean.cleaned.docx')
138
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index d8c7b83..7a1a9e7 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -12,7 +12,7 @@ from libmat2 import check_dependencies
12class TestCheckDependencies(unittest.TestCase): 12class TestCheckDependencies(unittest.TestCase):
13 def test_deps(self): 13 def test_deps(self):
14 ret = check_dependencies() 14 ret = check_dependencies()
15 for key, value in ret.items(): 15 for value in ret.values():
16 self.assertTrue(value) 16 self.assertTrue(value)
17 17
18 18
diff --git a/tests/test_policy.py b/tests/test_policy.py
index 890f8c3..ef55644 100644
--- a/tests/test_policy.py
+++ b/tests/test_policy.py
@@ -29,4 +29,3 @@ class TestPolicy(unittest.TestCase):
29 with self.assertRaises(ValueError): 29 with self.assertRaises(ValueError):
30 p.unknown_member_policy = UnknownMemberPolicy('unknown_policy_name_totally_invalid') 30 p.unknown_member_policy = UnknownMemberPolicy('unknown_policy_name_totally_invalid')
31 os.remove('./tests/data/clean.docx') 31 os.remove('./tests/data/clean.docx')
32