From de5917e5f01374bb1a647f49ae85283241a2bea9 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sat, 18 Jun 2011 04:42:52 +0200 Subject: Creation of the arborescence --- test/libtest.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 test/libtest.py (limited to 'test/libtest.py') diff --git a/test/libtest.py b/test/libtest.py new file mode 100755 index 0000000..2bd1fa7 --- /dev/null +++ b/test/libtest.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +''' + Unit test for the library +''' + +import unittest +import test +import sys +sys.path.append('..') +from lib import mat + +class Test_Remove_lib(test.MATTest): + def test_remove(self): + '''make sure that the lib remove all compromizing meta''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(dirty) + current_file.remove_all() + self.assertTrue(current_file.is_clean()) + + def test_remove_empty(self): + '''Test removal with clean files''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(clean) + current_file.remove_all() + self.assertTrue(current_file.is_clean()) + + +class Test_List_lib(test.MATTest): + def test_list(self): + '''check if get_meta returns all the expected meta''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(dirty) + meta_list = dict({"fixme":"please"},) + self.assertEqual(current_file.get_meta(), meta_list) + + def testlist_list_empty(self): + '''check that a listing of a clean file return an empty dict''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(clean) + self.assertEqual(current_file.get_meta(), dict()) #dirty, isn't it ? + + +class Test_isClean_lib(test.MATTest): + def test_dirty(self): + '''test is_clean on clean files''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(dirty) + self.assertTrue(current_file.is_clean()) + + def test_clean(self): + '''test is_clean on dirty files''' + for clean, dirty in self.file_list: + current_file = mat.create_class_file(clean) + self.assertFalse(current_file.is_clean()) + + +if __name__ == '__main__': + suite = unittest.TestSuite() + suite.addTest(unittest.makeSuite(Test_Remove_lib)) + suite.addTest(unittest.makeSuite(Test_List_lib)) + suite.addTest(unittest.makeSuite(Test_isClean_lib)) + unittest.TextTestRunner(verbosity=2).run(suite) + -- cgit v1.3