From 682af273485b86c1fbba4fcae905148ac2acd2a0 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Wed, 15 Oct 2014 00:17:59 +0200 Subject: [PATCH] tests: Add test case for file without permissions. --- tests/utils/test_path.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/utils/test_path.py b/tests/utils/test_path.py index 8c9d8255..f5684049 100644 --- a/tests/utils/test_path.py +++ b/tests/utils/test_path.py @@ -216,6 +216,7 @@ class FindMTimesTest(unittest.TestCase): DOES_NOT_EXIST = tests.path_to_data_dir('does-no-exist') SINGLE_FILE = tests.path_to_data_dir('blank.mp3') + NO_PERMISSION_FILE = tests.path_to_data_dir('no-permission-file') SINGLE_SYMLINK = tests.path_to_data_dir('find2/bar') DATA_DIR = tests.path_to_data_dir('') FIND_DIR = tests.path_to_data_dir('find') @@ -255,6 +256,12 @@ class FindMTimesTest(unittest.TestCase): self.assertEqual({}, result) self.assertEqual({self.SINGLE_SYMLINK: tests.IsA(Exception)}, errors) + def test_missing_permission_to_file(self): + # Note that we cannot know if we have access, but the stat will succeed + result, errors = path.find_mtimes(self.NO_PERMISSION_FILE) + self.assertEqual({self.NO_PERMISSION_FILE: tests.any_int}, result) + self.assertEqual({}, errors) + def test_missing_permission_to_directory(self): result, errors = path.find_mtimes(self.NO_PERMISSION_DIR) self.assertEqual({}, result)