summaryrefslogtreecommitdiff
path: root/test/libtest.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/libtest.py')
-rw-r--r--test/libtest.py21
1 files changed, 18 insertions, 3 deletions
diff --git a/test/libtest.py b/test/libtest.py
index e869381..a9ef383 100644
--- a/test/libtest.py
+++ b/test/libtest.py
@@ -103,13 +103,14 @@ class TestSecureRemove(unittest.TestCase):
103 self.assertRaises(MAT.exceptions.UnableToRemoveFile, MAT.mat.secure_remove, '/NOTREMOVABLE') 103 self.assertRaises(MAT.exceptions.UnableToRemoveFile, MAT.mat.secure_remove, '/NOTREMOVABLE')
104 104
105class TestArchiveProcessing(test.MATTest): 105class TestArchiveProcessing(test.MATTest):
106 ''' Test archives cleaning 106 ''' Test archives processing
107 ''' 107 '''
108 def test_remove_bz2(self): 108 def test_remove_bz2(self):
109 tarpath = os.path.join(self.tmpdir, "test.tar.bz2") 109 tarpath = os.path.join(self.tmpdir, "test.tar.bz2")
110 tar = tarfile.open(tarpath, "w:bz2") 110 tar = tarfile.open(tarpath, "w:bz2")
111 for _,dirty in self.file_list: 111 for clean,dirty in self.file_list:
112 tar.add(dirty) 112 tar.add(dirty)
113 tar.add(clean)
113 tar.close() 114 tar.close()
114 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 115 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False)
115 current_file.remove_all() 116 current_file.remove_all()
@@ -119,14 +120,28 @@ class TestArchiveProcessing(test.MATTest):
119 def test_remove_tar(self): 120 def test_remove_tar(self):
120 tarpath = os.path.join(self.tmpdir, "test.tar") 121 tarpath = os.path.join(self.tmpdir, "test.tar")
121 tar = tarfile.open(tarpath, "w") 122 tar = tarfile.open(tarpath, "w")
122 for _,dirty in self.file_list: 123 for clean,dirty in self.file_list:
123 tar.add(dirty) 124 tar.add(dirty)
125 tar.add(clean)
124 tar.close() 126 tar.close()
125 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 127 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False)
126 current_file.remove_all() 128 current_file.remove_all()
127 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) 129 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False)
128 self.assertTrue(current_file.is_clean()) 130 self.assertTrue(current_file.is_clean())
129 131
132 def test_get_unsupported(self):
133 tarpath = os.path.join(self.tmpdir, "test.tar.bz2")
134 tar = tarfile.open(tarpath, "w")
135 for clean,dirty in self.file_list[:4]: # we don't test thoses
136 tar.add(dirty)
137 tar.add(clean)
138 for f in ('../mat.desktop', '../README.security', '../setup.py'):
139 tar.add(f, f[3:]) # trim '../'
140 tar.close()
141 current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False)
142 unsupported_files = set(current_file.is_clean(list_unsupported=True))
143 self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py')))
144
130def get_tests(): 145def get_tests():
131 ''' Returns every libtests''' 146 ''' Returns every libtests'''
132 suite = unittest.TestSuite() 147 suite = unittest.TestSuite()