From 70ef290a5db26309bc9112e6007bee77331ddebe Mon Sep 17 00:00:00 2001 From: jvoisin Date: Thu, 3 Dec 2015 14:42:21 +0100 Subject: Add some file-attribute related tests --- test/clitest.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/clitest.py') diff --git a/test/clitest.py b/test/clitest.py index ec3c19c..3b09c62 100644 --- a/test/clitest.py +++ b/test/clitest.py @@ -10,6 +10,7 @@ import unittest import subprocess import sys import tarfile +import stat import test MAT_PATH = 'mat' @@ -113,6 +114,14 @@ class TestFileAttributes(unittest.TestCase): stdout, _ = proc.communicate() self.assertEqual(str(stdout).strip('\n'), '[-] Unable to process empty_file') + def test_not_readable(self): + """ test MAT's behaviour on non-writable file""" + open('non_readable', 'a').close() + os.chmod('non_readable', 0 & stat.S_IWRITE) + proc = subprocess.Popen([MAT_PATH, 'non_readable'], stdout=subprocess.PIPE) + stdout, _ = proc.communicate() + os.remove('non_readable') + class TestUnsupported(test.MATTest): """ test MAT's behaviour on unsupported files """ -- cgit v1.3