diff options
| author | jvoisin | 2011-12-15 17:52:42 +0100 |
|---|---|---|
| committer | jvoisin | 2011-12-15 17:52:42 +0100 |
| commit | 73fc22ab0ce58ebba633d517ca436743fe62df57 (patch) | |
| tree | 8218010b7fb64111dd77e1f3be2db06a38ffbe60 /test/clitest.py | |
| parent | b9fde4ea1eb34a2f1ead1e3bfa6252fb1ca82220 (diff) | |
| parent | 13f102b65c8cf9981b2925495b95d20047b3932f (diff) | |
Merge branch 'master' of ssh://git-rw.torproject.org/user/jvoisin/mat
Diffstat (limited to 'test/clitest.py')
| -rw-r--r-- | test/clitest.py | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/test/clitest.py b/test/clitest.py index cb615ce..4155d45 100644 --- a/test/clitest.py +++ b/test/clitest.py | |||
| @@ -72,10 +72,33 @@ class TestisCleancli(test.MATTest): | |||
| 72 | stdout, _ = proc.communicate() | 72 | stdout, _ = proc.communicate() |
| 73 | self.assertEqual(stdout.strip('\n'), '[+] %s is not clean' % dirty) | 73 | self.assertEqual(stdout.strip('\n'), '[+] %s is not clean' % dirty) |
| 74 | 74 | ||
| 75 | class TestFileAttributes(unittest.TestCase): | ||
| 76 | ''' | ||
| 77 | test various stuffs about files (readable, writable, exist, ...) | ||
| 78 | ''' | ||
| 79 | def test_not_readable(self): | ||
| 80 | proc = subprocess.Popen(['../mat-cli', 'not_readable'], | ||
| 81 | stdout=subprocess.PIPE) | ||
| 82 | stdout, _ = proc.communicate() | ||
| 83 | self.assertEqual(stdout.strip('\n'), 'Unable to pocess %s' % 'not_readable') | ||
| 84 | |||
| 85 | def test_not_writtable(self): | ||
| 86 | proc = subprocess.Popen(['../mat-cli', 'not_writtable'], | ||
| 87 | stdout=subprocess.PIPE) | ||
| 88 | stdout, _ = proc.communicate() | ||
| 89 | self.assertEqual(stdout.strip('\n'), 'Unable to pocess %s' % 'not_writtable') | ||
| 90 | |||
| 91 | def test_not_exist(self): | ||
| 92 | proc = subprocess.Popen(['../mat-cli', 'ilikecookies'], | ||
| 93 | stdout=subprocess.PIPE) | ||
| 94 | stdout, _ = proc.communicate() | ||
| 95 | self.assertEqual(stdout.strip('\n'), 'Unable to pocess %s' % 'ilikecookies') | ||
| 75 | 96 | ||
| 76 | if __name__ == '__main__': | 97 | if __name__ == '__main__': |
| 77 | suite = unittest.TestSuite() | 98 | suite = unittest.TestSuite() |
| 78 | suite.addTest(unittest.makeSuite(TestRemovecli)) | 99 | suite.addTest(unittest.makeSuite(TestRemovecli)) |
| 79 | suite.addTest(unittest.makeSuite(TestListcli)) | 100 | suite.addTest(unittest.makeSuite(TestListcli)) |
| 80 | suite.addTest(unittest.makeSuite(TestisCleancli)) | 101 | suite.addTest(unittest.makeSuite(TestisCleancli)) |
| 81 | unittest.TextTestRunner(verbosity=test.VERBOSITY).run(suite) | 102 | test_result = unittest.TextTestRunner(verbosity=test.VERBOSITY).run(suite) |
| 103 | sys.exit(len(test_result.failures)) | ||
| 104 | |||
