From af36529554c39a2eefcc2c8723715e2d25b401b8 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 8 Jun 2014 13:39:18 +0200 Subject: Rename the MAT folder to libmat. This commit fixes some issues for dump operating systems who doesn't handle capitalization. --- test/libtest.py | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) (limited to 'test/libtest.py') 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 import unittest sys.path.append('..') -import MAT +import libmat class TestRemovelib(test.MATTest): @@ -23,17 +23,17 @@ class TestRemovelib(test.MATTest): def test_remove(self): '''make sure that the lib remove all compromizing meta''' for _, dirty in self.file_list: - current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) + current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) current_file.remove_all() - current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) + current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) self.assertTrue(current_file.is_clean()) def test_remove_empty(self): '''Test removal with clean files''' for clean, _ in self.file_list: - current_file = MAT.mat.create_class_file(clean, False, add2archive=True) + current_file = libmat.mat.create_class_file(clean, False, add2archive=True) current_file.remove_all() - current_file = MAT.mat.create_class_file(clean, False, add2archive=True) + current_file = libmat.mat.create_class_file(clean, False, add2archive=True) self.assertTrue(current_file.is_clean()) @@ -43,13 +43,13 @@ class TestListlib(test.MATTest): def test_list(self): '''check if get_meta returns metadata''' for _, dirty in self.file_list: - current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) + current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) self.assertIsNotNone(current_file.get_meta()) def testlist_list_empty(self): '''check that a listing of a clean file returns an empty dict''' for clean, _ in self.file_list: - current_file = MAT.mat.create_class_file(clean, False, add2archive=True) + current_file = libmat.mat.create_class_file(clean, False, add2archive=True) self.assertEqual(current_file.get_meta(), dict()) @@ -59,13 +59,13 @@ class TestisCleanlib(test.MATTest): def test_dirty(self): '''test is_clean on dirty files''' for _, dirty in self.file_list: - current_file = MAT.mat.create_class_file(dirty, False, add2archive=True) + current_file = libmat.mat.create_class_file(dirty, False, add2archive=True) self.assertFalse(current_file.is_clean()) def test_clean(self): '''test is_clean on clean files''' for clean, _ in self.file_list: - current_file = MAT.mat.create_class_file(clean, False, add2archive=True) + current_file = libmat.mat.create_class_file(clean, False, add2archive=True) self.assertTrue(current_file.is_clean()) @@ -75,12 +75,12 @@ class TestFileAttributes(unittest.TestCase): ''' def test_not_exist(self): ''' test MAT's behaviour on non-existent file''' - self.assertFalse(MAT.mat.create_class_file('non_existent_file', False, add2archive=True)) + self.assertFalse(libmat.mat.create_class_file('non_existent_file', False, add2archive=True)) def test_empty(self): ''' test MAT's behaviour on empty file''' open('empty_file', 'a').close() - self.assertFalse(MAT.mat.create_class_file('empty_file', False, add2archive=True)) + self.assertFalse(libmat.mat.create_class_file('empty_file', False, add2archive=True)) os.remove('empty_file') @@ -91,12 +91,12 @@ class TestSecureRemove(unittest.TestCase): ''' test the secure removal of an existing file ''' _, file_to_remove = tempfile.mkstemp() - self.assertTrue(MAT.mat.secure_remove(file_to_remove)) + self.assertTrue(libmat.mat.secure_remove(file_to_remove)) def test_remove_fail(self): ''' test the secure removal of an non-removable file ''' - self.assertRaises(MAT.exceptions.UnableToWriteFile, MAT.mat.secure_remove, '/NOTREMOVABLE') + self.assertRaises(libmat.exceptions.UnableToWriteFile, libmat.mat.secure_remove, '/NOTREMOVABLE') class TestArchiveProcessing(test.MATTest): @@ -111,9 +111,9 @@ class TestArchiveProcessing(test.MATTest): tar.add(dirty) tar.add(clean) tar.close() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) current_file.remove_all() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) self.assertTrue(current_file.is_clean()) def test_remove_tar(self): @@ -125,9 +125,9 @@ class TestArchiveProcessing(test.MATTest): tar.add(dirty) tar.add(clean) tar.close() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) current_file.remove_all() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) self.assertTrue(current_file.is_clean()) def test_remove_gz(self): @@ -139,9 +139,9 @@ class TestArchiveProcessing(test.MATTest): tar.add(dirty) tar.add(clean) tar.close() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) current_file.remove_all() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) self.assertTrue(current_file.is_clean()) def test_get_unsupported(self): @@ -152,16 +152,16 @@ class TestArchiveProcessing(test.MATTest): for f in ('../mat.desktop', '../README.security', '../setup.py'): tar.add(f, f[3:]) # trim '../' tar.close() - current_file = MAT.mat.create_class_file(tarpath, False, add2archive=False) + current_file = libmat.mat.create_class_file(tarpath, False, add2archive=False) unsupported_files = set(current_file.is_clean(list_unsupported=True)) self.assertEqual(unsupported_files, set(('mat.desktop', 'README.security', 'setup.py'))) def test_archive_unwritable_content(self): path = os.path.join(self.tmpdir, './unwritable_content.zip') shutil.copy2('./unwritable_content.zip', self.tmpdir) - current_file = MAT.mat.create_class_file(path, False, add2archive=False) + current_file = libmat.mat.create_class_file(path, False, add2archive=False) current_file.remove_all() - current_file = MAT.mat.create_class_file(path, False, add2archive=False) + current_file = libmat.mat.create_class_file(path, False, add2archive=False) self.assertTrue(current_file.is_clean()) def get_tests(): -- cgit v1.3