Skip to content

Commit 296c154

Browse files
committed
Update test_utils.py
added test case to check if any change in file-permission is made
1 parent b68b014 commit 296c154

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_utils.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from __future__ import absolute_import
22
from tests import testlib
33

4+
import unittest
5+
import os
6+
47
try:
58
from utils import *
69
except ImportError:
@@ -76,6 +79,27 @@ def test_dslice_all_args(self):
7679
}
7780
self.assertTrue(expected == dslice(TEST_DICT, *test_args))
7881

82+
class FilePermissionTest(unittest.TestCase):
83+
84+
def setUp(self):
85+
super(FilePermissionTest, self).setUp()
86+
87+
def test_filePermissions(self):
88+
89+
def checkFilePermissions(dir_path):
90+
for file in os.listdir(dir_path):
91+
if file.__contains__('pycache'):
92+
continue
93+
path = os.path.join(dir_path, file)
94+
if os.path.isfile(path):
95+
permission = oct(os.stat(path).st_mode)
96+
self.assertEqual(permission, '0o100644')
97+
else:
98+
checkFilePermissions(path)
99+
100+
dir_path = os.path.join('..', 'splunklib')
101+
checkFilePermissions(dir_path)
102+
79103

80104
if __name__ == "__main__":
81105
try:

0 commit comments

Comments
 (0)