summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorjvoisin2011-06-30 18:15:26 +0200
committerjvoisin2011-06-30 18:15:26 +0200
commit4b1323af17f144724d5ca0c8c35f1aa5253655f6 (patch)
tree48cdf2b7eb4d60e0a82d4d828a16ee707c54c957 /test
parenta62aab0c52c0826097f2f883c9c9aa8f9b66a5e8 (diff)
Secure removal of the temp file used by the testing suite
Diffstat (limited to 'test')
-rw-r--r--test/clean.jpgbin47793 -> 1328 bytes
-rw-r--r--test/clean.pngbin1345 -> 4469 bytes
-rw-r--r--test/dirty.jpgbin47818 -> 1425 bytes
-rw-r--r--test/dirty.pngbin1382 -> 4512 bytes
-rw-r--r--test/test.py19
5 files changed, 12 insertions, 7 deletions
diff --git a/test/clean.jpg b/test/clean.jpg
index be06da5..4e89b40 100644
--- a/test/clean.jpg
+++ b/test/clean.jpg
Binary files differ
diff --git a/test/clean.png b/test/clean.png
index 2ce9efd..9339196 100644
--- a/test/clean.png
+++ b/test/clean.png
Binary files differ
diff --git a/test/dirty.jpg b/test/dirty.jpg
index a075590..71c32c7 100644
--- a/test/dirty.jpg
+++ b/test/dirty.jpg
Binary files differ
diff --git a/test/dirty.png b/test/dirty.png
index f37213f..5e4c093 100644
--- a/test/dirty.png
+++ b/test/dirty.png
Binary files differ
diff --git a/test/test.py b/test/test.py
index f095157..f856394 100644
--- a/test/test.py
+++ b/test/test.py
@@ -6,6 +6,7 @@
6''' 6'''
7 7
8import shutil 8import shutil
9import os
9import glob 10import glob
10import sys 11import sys
11import tempfile 12import tempfile
@@ -18,14 +19,18 @@ FILE_LIST = zip(glob.glob('clean*'), glob.glob('dirty*'))
18class MATTest(unittest.TestCase): 19class MATTest(unittest.TestCase):
19 def setUp(self): 20 def setUp(self):
20 '''create working copy of the clean and the dirty file in the TMP dir''' 21 '''create working copy of the clean and the dirty file in the TMP dir'''
21 self.file_list = [] 22 self.file_list = []
22 self.tmpdir = tempfile.mkdtemp() 23 self.tmpdir = tempfile.mkdtemp()
23 24
24 for clean, dirty in FILE_LIST: 25 for clean, dirty in FILE_LIST:
25 shutil.copy2(clean, self.tmpdir + clean) 26 shutil.copy2(clean, self.tmpdir + clean)
26 shutil.copy2(dirty, self.tmpdir + dirty) 27 shutil.copy2(dirty, self.tmpdir + dirty)
27 self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty)) 28 self.file_list.append((self.tmpdir + clean, self.tmpdir + dirty))
28 29
29 def tearDown(self): 30 def tearDown(self):
30 '''Remove the tmp folder''' 31 '''Remove the tmp folder'''
31 shutil.rmtree(self.tmpdir) 32 for root, dirs, files in os.walk(self.tmpdir, topdown=False):
33 for name in files:
34 mat.secure_remove(os.path.join(toor, name))
35 for name in dirs:
36 os.rmdir(os.path.join(root, name))