diff options
| author | jvoisin | 2011-06-10 01:29:29 +0200 |
|---|---|---|
| committer | jvoisin | 2011-06-10 01:29:29 +0200 |
| commit | c308cf7daaa4fa46377e2df0f2e9a397981e19b2 (patch) | |
| tree | f016ce17cd6747acc068a7d2fc5093d1bd96fa9e /libtest.py | |
| parent | f7082a21d6511c5069fbb9ff186ce22f3e22fed7 (diff) | |
The current version is (mostly) working
Diffstat (limited to '')
| -rw-r--r-- | libtest.py | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/libtest.py b/libtest.py new file mode 100644 index 0000000..191a981 --- /dev/null +++ b/libtest.py | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | import mat | ||
| 2 | import unittest | ||
| 3 | import test | ||
| 4 | |||
| 5 | class Test_Remove_lib(test.MATTest): | ||
| 6 | def test_remove(self): | ||
| 7 | '''make sure that the lib remove all compromizing meta''' | ||
| 8 | for clean, dirty in self.file_list: | ||
| 9 | current_file = mat.create_class_file(dirty) | ||
| 10 | current_file.remove_all() | ||
| 11 | self.assertTrue(current_file.is_clean()) | ||
| 12 | |||
| 13 | def test_remove_empty(self): | ||
| 14 | '''Test removal with clean files''' | ||
| 15 | for clean, dirty in self.file_list: | ||
| 16 | current_file = mat.create_class_file(clean) | ||
| 17 | current_file.remove_all() | ||
| 18 | self.assertTrue(current_file.is_clean()) | ||
| 19 | |||
| 20 | |||
| 21 | class Test_List_lib(test.MATTest): | ||
| 22 | def test_list(self): | ||
| 23 | '''check if get_meta returns all the expected meta''' | ||
| 24 | for clean, dirty in self.file_list: | ||
| 25 | current_file = mat.create_class_file(dirty) | ||
| 26 | meta_list = dict({"fixme":"please"},) | ||
| 27 | self.assertDictEqual(current_file.get_meta(), meta_list) | ||
| 28 | |||
| 29 | def testlist_list_empty(self): | ||
| 30 | '''check that a listing of a clean file return an empty dict''' | ||
| 31 | for clean, dirty in self.file_list: | ||
| 32 | current_file = mat.create_class_file(clean) | ||
| 33 | self.assertEqual(current_file.get_meta(), dict()) #dirty, isn't it ? | ||
| 34 | |||
| 35 | |||
| 36 | class Test_isClean_lib(test.MATTest): | ||
| 37 | def test_clean(self): | ||
| 38 | '''test is_clean on clean files''' | ||
| 39 | for clean, dirty in self.file_list: | ||
| 40 | current_file = mat.create_class_file(dirty) | ||
| 41 | self.assertTrue(current_file.is_clean()) | ||
| 42 | |||
| 43 | def test_clean(self): | ||
| 44 | '''test is_clean on dirty files''' | ||
| 45 | for clean, dirty in self.file_list: | ||
| 46 | current_file = mat.create_class_file(clean) | ||
| 47 | self.assertFalse(current_file.is_clean()) | ||
| 48 | |||
| 49 | |||
| 50 | if __name__ == '__main__': | ||
| 51 | suite = unittest.TestSuite() | ||
| 52 | suite.addTest(unittest.makeSuite(Test_Remove_lib)) | ||
| 53 | suite.addTest(unittest.makeSuite(Test_List_lib)) | ||
| 54 | suite.addTest(unittest.makeSuite(Test_isClean_lib)) | ||
| 55 | unittest.TextTestRunner(verbosity=2).run(suite) | ||
| 56 | |||
