diff options
| author | jvoisin | 2014-01-02 15:04:17 +0000 |
|---|---|---|
| committer | jvoisin | 2014-01-02 15:04:17 +0000 |
| commit | 5cbcd67aa4d5718fbe33b7af8d7ec8e5756d551a (patch) | |
| tree | e4ad40a1491187160a300b658f7d987ebe206b26 /test/libtest.py | |
| parent | 2b0882841343465fee56df403d2c59af158c4a7d (diff) | |
Add some archive-related tests
Diffstat (limited to '')
| -rw-r--r-- | test/libtest.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libtest.py b/test/libtest.py index f92d933..51caf28 100644 --- a/test/libtest.py +++ b/test/libtest.py | |||
| @@ -9,6 +9,8 @@ import unittest | |||
| 9 | import test | 9 | import test |
| 10 | import sys | 10 | import sys |
| 11 | import tempfile | 11 | import tempfile |
| 12 | import tarfile | ||
| 13 | |||
| 12 | sys.path.append('..') | 14 | sys.path.append('..') |
| 13 | import MAT | 15 | import MAT |
| 14 | 16 | ||
| @@ -99,6 +101,28 @@ class TestSecureRemove(unittest.TestCase): | |||
| 99 | ''' | 101 | ''' |
| 100 | self.assertRaises(MAT.exceptions.UnableToRemoveFile, MAT.mat.secure_remove, '/NOTREMOVABLE') | 102 | self.assertRaises(MAT.exceptions.UnableToRemoveFile, MAT.mat.secure_remove, '/NOTREMOVABLE') |
| 101 | 103 | ||
| 104 | class TestArchiveProcessing(test.MATTest): | ||
| 105 | ''' Test archives cleaning | ||
| 106 | ''' | ||
| 107 | def test_remove_bz2(self): | ||
| 108 | tar = tarfile.open("test.tar.bz2", "w:bz2") | ||
| 109 | for _,dirty in self.file_list: | ||
| 110 | tar.add(dirty) | ||
| 111 | tar.close() | ||
| 112 | current_file = MAT.mat.create_class_file("test.tar.bz2", False, add2archive=False) | ||
| 113 | current_file.remove_all() | ||
| 114 | current_file = MAT.mat.create_class_file("test.tar.bz2", False, add2archive=False) | ||
| 115 | self.assertTrue(current_file.is_clean()) | ||
| 116 | |||
| 117 | def test_remove_tar(self): | ||
| 118 | tar = tarfile.open("test.tar", "w") | ||
| 119 | for _,dirty in self.file_list: | ||
| 120 | tar.add(dirty) | ||
| 121 | tar.close() | ||
| 122 | current_file = MAT.mat.create_class_file("test.tar", False, add2archive=False) | ||
| 123 | current_file.remove_all() | ||
| 124 | current_file = MAT.mat.create_class_file("test.tar", False, add2archive=False) | ||
| 125 | self.assertTrue(current_file.is_clean()) | ||
| 102 | 126 | ||
| 103 | def get_tests(): | 127 | def get_tests(): |
| 104 | ''' Returns every libtests''' | 128 | ''' Returns every libtests''' |
| @@ -108,6 +132,7 @@ def get_tests(): | |||
| 108 | suite.addTest(unittest.makeSuite(TestisCleanlib)) | 132 | suite.addTest(unittest.makeSuite(TestisCleanlib)) |
| 109 | suite.addTest(unittest.makeSuite(TestFileAttributes)) | 133 | suite.addTest(unittest.makeSuite(TestFileAttributes)) |
| 110 | suite.addTest(unittest.makeSuite(TestSecureRemove)) | 134 | suite.addTest(unittest.makeSuite(TestSecureRemove)) |
| 135 | suite.addTest(unittest.makeSuite(TestArchiveProcessing)) | ||
| 111 | return suite | 136 | return suite |
| 112 | 137 | ||
| 113 | 138 | ||
