diff options
| author | jvoisin | 2014-06-08 13:39:18 +0200 |
|---|---|---|
| committer | jvoisin | 2014-06-08 13:39:18 +0200 |
| commit | af36529554c39a2eefcc2c8723715e2d25b401b8 (patch) | |
| tree | f54b964520bab44d1dfac725086211eaf22d3763 /test | |
| parent | ef5a32cfd3c0555ffe5ddf413eeaae61622ebb4b (diff) | |
Rename the MAT folder to libmat.
This commit fixes some issues for dump operating
systems who doesn't handle capitalization.
Diffstat (limited to '')
| -rw-r--r-- | test/clitest.py | 2 | ||||
| -rw-r--r-- | test/libtest.py | 44 |
2 files changed, 23 insertions, 23 deletions
diff --git a/test/clitest.py b/test/clitest.py index ad895f5..13d545a 100644 --- a/test/clitest.py +++ b/test/clitest.py | |||
| @@ -12,7 +12,7 @@ import sys | |||
| 12 | import tarfile | 12 | import tarfile |
| 13 | 13 | ||
| 14 | sys.path.append('..') | 14 | sys.path.append('..') |
| 15 | from MAT import mat | 15 | from libmat import mat |
| 16 | import test | 16 | import test |
| 17 | 17 | ||
| 18 | 18 | ||
diff --git a/test/libtest.py b/test/libtest.py index fdef091..1b25f86 100644 --- a/test/libtest.py +++ b/test/libtest.py | |||
| @@ -14,7 +14,7 @@ import test | |||
| 14 | import unittest | 14 | import unittest |
| 15 | 15 | ||
| 16 | sys.path.append('..') | 16 | sys.path.append('..') |
| 17 | import MAT | 17 | import libmat |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | class TestRemovelib(test.MATTest): | 20 | class TestRemovelib(test.MATTest): |
| @@ -23,17 +23,17 @@ class TestRemovelib(test.MATTest): | |||
| 23 | def test_remove(self): | 23 | def test_remove(self): |
| 24 | '''make sure that the lib remove all compromizing meta''' | 24 | '''make sure that the lib remove all compromizing meta''' |
| 25 | for _, dirty in self.file_list: | 25 | for _, dirty in self.file_list: |
| 26 | current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) | 26 | current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) |
| 27 | current_file.remove_all() | 27 | current_file.remove_all() |
| 28 | current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) | 28 | current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) |
| 29 | self.assertTrue(current_file.is_clean()) | 29 | self.assertTrue(current_file.is_clean()) |
| 30 | 30 | ||
| 31 | def test_remove_empty(self): | 31 | def test_remove_empty(self): |
| 32 | '''Test removal with clean files''' | 32 | '''Test removal with clean files''' |
| 33 | for clean, _ in self.file_list: | 33 | for clean, _ in self.file_list: |
| 34 | current_file = MAT.mat.create_class_file(clean, False, add2archive=True) | 34 | current_file = libmat.mat.create_class_file(clean, False, add2archive=True) |
| 35 | current_file.remove_all() | 35 | current_file.remove_all() |
| 36 | current_file = MAT.mat.create_class_file(clean, False, add2archive=True) | 36 | current_file = libmat.mat.create_class_file(clean, False, add2archive=True) |
| 37 | self.assertTrue(current_file.is_clean()) | 37 | self.assertTrue(current_file.is_clean()) |
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -43,13 +43,13 @@ class TestListlib(test.MATTest): | |||
| 43 | def test_list(self): | 43 | def test_list(self): |
| 44 | '''check if get_meta returns metadata''' | 44 | '''check if get_meta returns metadata''' |
| 45 | for _, dirty in self.file_list: | 45 | for _, dirty in self.file_list: |
| 46 | current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) | 46 | current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) |
| 47 | self.assertIsNotNone(current_file.get_meta()) | 47 | self.assertIsNotNone(current_file.get_meta()) |
| 48 | 48 | ||
| 49 | def testlist_list_empty(self): | 49 | def testlist_list_empty(self): |
| 50 | '''check that a listing of a clean file returns an empty dict''' | 50 | '''check that a listing of a clean file returns an empty dict''' |
| 51 | for clean, _ in self.file_list: | 51 | for clean, _ in self.file_list: |
| 52 | current_file = MAT.mat.create_class_file(clean, False, add2archive=True) | 52 | current_file = libmat.mat.create_class_file(clean, False, add2archive=True) |
| 53 | self.assertEqual(current_file.get_meta(), dict()) | 53 | self.assertEqual(current_file.get_meta(), dict()) |
| 54 | 54 | ||
| 55 | 55 | ||
| @@ -59,13 +59,13 @@ class TestisCleanlib(test.MATTest): | |||
| 59 | def test_dirty(self): | 59 | def test_dirty(self): |
| 60 | '''test is_clean on dirty files''' | 60 | '''test is_clean on dirty files''' |
| 61 | for _, dirty in self.file_list: | 61 | for _, dirty in self.file_list: |
| 62 | current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) | 62 | current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) |
| 63 | self.assertFalse(current_file.is_clean()) | 63 | self.assertFalse(current_file.is_clean()) |
| 64 | 64 | ||
| 65 | def test_clean(self): | 65 | def test_clean(self): |
| 66 | '''test is_clean on clean files''' | 66 | '''test is_clean on clean files''' |
| 67 | for clean, _ in self.file_list: | 67 | for clean, _ in self.file_list: |
| 68 | current_file = MAT.mat.create_class_file(clean, False, add2archive=True) | 68 | current_file = libmat.mat.create_class_file(clean, False, add2archive=True) |
| 69 | self.assertTrue(current_file.is_clean()) | 69 | self.assertTrue(current_file.is_clean()) |
| 70 | 70 | ||
| 71 | 71 | ||
| @@ -75,12 +75,12 @@ class TestFileAttributes(unittest.TestCase): | |||
| 75 | ''' | 75 | ''' |
| 76 | def test_not_exist(self): | 76 | def test_not_exist(self): |
| 77 | ''' test MAT's behaviour on non-existent file''' | 77 | ''' test MAT's behaviour on non-existent file''' |
| 78 | self.assertFalse(MAT.mat.create_class_file('non_existent_file', False, add2archive=True)) | 78 | self.assertFalse(libmat.mat.create_class_file('non_existent_file', False, add2archive=True)) |
| 79 | 79 | ||
| 80 | def test_empty(self): | 80 | def test_empty(self): |
| 81 | ''' test MAT's behaviour on empty file''' | 81 | ''' test MAT's behaviour on empty file''' |
| 82 | open('empty_file', 'a').close() | 82 | open('empty_file', 'a').close() |
| 83 | self.assertFalse(MAT.mat.create_class_file('empty_file', False, add2archive=True)) | 83 | self.assertFalse(libmat.mat.create_class_file('empty_file', False, add2archive=True)) |
| 84 | os.remove('empty_file') | 84 | os.remove('empty_file') |
| 85 | 85 | ||
| 86 | 86 | ||
| @@ -91,12 +91,12 @@ class TestSecureRemove(unittest.TestCase): | |||
| 91 | ''' test the secure removal of an existing file | 91 | ''' test the secure removal of an existing file |
| 92 | ''' | 92 | ''' |
| 93 | _, file_to_remove = tempfile.mkstemp() | 93 | _, file_to_remove = tempfile.mkstemp() |
| 94 | self.assertTrue(MAT.mat.secure_remove(file_to_remove)) | 94 | self.assertTrue(libmat.mat.secure_remove(file_to_remove)) |
| 95 | 95 | ||
| 96 | def test_remove_fail(self): | 96 | def test_remove_fail(self): |
| 97 | ''' test the secure removal of an non-removable file | 97 | ''' test the secure removal of an non-removable file |
| 98 | ''' | 98 | ''' |
| 99 | self.assertRaises(MAT.exceptions.UnableToWriteFile, MAT.mat.secure_remove, '/NOTREMOVABLE') | 99 | self.assertRaises(libmat.exceptions.UnableToWriteFile, libmat.mat.secure_remove, '/NOTREMOVABLE') |
| 100 | 100 | ||
| 101 | 101 | ||
| 102 | class TestArchiveProcessing(test.MATTest): | 102 | class TestArchiveProcessing(test.MATTest): |
| @@ -111,9 +111,9 @@ class TestArchiveProcessing(test.MATTest): | |||
| 111 | tar.add(dirty) | 111 | tar.add(dirty) |
| 112 | tar.add(clean) | 112 | tar.add(clean) |
| 113 | tar.close() | 113 | tar.close() |
| 114 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 114 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 115 | current_file.remove_all() | 115 | current_file.remove_all() |
| 116 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 116 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 117 | self.assertTrue(current_file.is_clean()) | 117 | self.assertTrue(current_file.is_clean()) |
| 118 | 118 | ||
| 119 | def test_remove_tar(self): | 119 | def test_remove_tar(self): |
| @@ -125,9 +125,9 @@ class TestArchiveProcessing(test.MATTest): | |||
| 125 | tar.add(dirty) | 125 | tar.add(dirty) |
| 126 | tar.add(clean) | 126 | tar.add(clean) |
| 127 | tar.close() | 127 | tar.close() |
| 128 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 128 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 129 | current_file.remove_all() | 129 | current_file.remove_all() |
| 130 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 130 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 131 | self.assertTrue(current_file.is_clean()) | 131 | self.assertTrue(current_file.is_clean()) |
| 132 | 132 | ||
| 133 | def test_remove_gz(self): | 133 | def test_remove_gz(self): |
| @@ -139,9 +139,9 @@ class TestArchiveProcessing(test.MATTest): | |||
| 139 | tar.add(dirty) | 139 | tar.add(dirty) |
| 140 | tar.add(clean) | 140 | tar.add(clean) |
| 141 | tar.close() | 141 | tar.close() |
| 142 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 142 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 143 | current_file.remove_all() | 143 | current_file.remove_all() |
| 144 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 144 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 145 | self.assertTrue(current_file.is_clean()) | 145 | self.assertTrue(current_file.is_clean()) |
| 146 | 146 | ||
| 147 | def test_get_unsupported(self): | 147 | def test_get_unsupported(self): |
| @@ -152,16 +152,16 @@ class TestArchiveProcessing(test.MATTest): | |||
| 152 | for f in ('../mat.desktop', '../README.security', '../setup.py'): | 152 | for f in ('../mat.desktop', '../README.security', '../setup.py'): |
| 153 | tar.add(f, f[3:]) # trim '../' | 153 | tar.add(f, f[3:]) # trim '../' |
| 154 | tar.close() | 154 | tar.close() |
| 155 | current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) | 155 | current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) |
| 156 | unsupported_files = set(current_file.is_clean(list_unsupported=True)) | 156 | unsupported_files = set(current_file.is_clean(list_unsupported=True)) |
| 157 | self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py'))) | 157 | self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py'))) |
| 158 | 158 | ||
| 159 | def test_archive_unwritable_content(self): | 159 | def test_archive_unwritable_content(self): |
| 160 | path = os.path.join(self.tmpdir, './unwritable_content.zip') | 160 | path = os.path.join(self.tmpdir, './unwritable_content.zip') |
| 161 | shutil.copy2('./unwritable_content.zip', self.tmpdir) | 161 | shutil.copy2('./unwritable_content.zip', self.tmpdir) |
| 162 | current_file = MAT.mat.create_class_file(path, False, add2archive=False) | 162 | current_file = libmat.mat.create_class_file(path, False, add2archive=False) |
| 163 | current_file.remove_all() | 163 | current_file.remove_all() |
| 164 | current_file = MAT.mat.create_class_file(path, False, add2archive=False) | 164 | current_file = libmat.mat.create_class_file(path, False, add2archive=False) |
| 165 | self.assertTrue(current_file.is_clean()) | 165 | self.assertTrue(current_file.is_clean()) |
| 166 | 166 | ||
| 167 | def get_tests(): | 167 | def get_tests(): |
