From 1bb8abef14af4690385aeb1185a52d5456ec11d8 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 11 Dec 2011 17:12:23 +0100 Subject: Handle files with stupid rights Now, files that are not readable, or writatble, or non-existent are correctly handled. --- test/libtest.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/libtest.py') diff --git a/test/libtest.py b/test/libtest.py index ecbc03e..0df584f 100644 --- a/test/libtest.py +++ b/test/libtest.py @@ -64,11 +64,24 @@ class TestisCleanlib(test.MATTest): current_file = mat.create_class_file(clean, False, True) self.assertTrue(current_file.is_clean()) +class TestFileAttributes(unittest.TestCase): + ''' + test various stuffs about files (readable, writable, exist, ...) + ''' + def test_not_readable(self): + self.assertFalse(mat.create_class_file('not_readable', False, True)) + + def test_not_writtable(self): + self.assertFalse(mat.create_class_file('not_writtable', False, True)) + + def test_not_exist(self): + self.assertFalse(mat.create_class_file('ilikecookies', False, True)) if __name__ == '__main__': Suite = unittest.TestSuite() Suite.addTest(unittest.makeSuite(TestRemovelib)) Suite.addTest(unittest.makeSuite(TestListlib)) Suite.addTest(unittest.makeSuite(TestisCleanlib)) + Suite.addTest(unittest.makeSuite(TestFileAttributes)) unittest.TextTestRunner(verbosity=test.VERBOSITY).run(Suite) -- cgit v1.3