File tree Expand file tree Collapse file tree 2 files changed +32
-26
lines changed Expand file tree Collapse file tree 2 files changed +32
-26
lines changed Original file line number Diff line number Diff line change 1- from pathlib import Path
2- import unittest
3- import os
41from tests import testlib
52from utils import dslice
63
@@ -61,29 +58,6 @@ def test_dslice_all_args(self):
6158 self .assertTrue (expected == dslice (TEST_DICT , * test_args ))
6259
6360
64- class FilePermissionTest (unittest .TestCase ):
65- def setUp (self ):
66- super ().setUp ()
67-
68- # Check for any change in the default file permission(i.e 644) for all files within splunklib
69- def test_filePermissions (self ):
70- def checkFilePermissions (dir_path ):
71- for file in os .listdir (dir_path ):
72- if file .__contains__ ("pycache" ):
73- continue
74- path = os .path .join (dir_path , file )
75- if os .path .isfile (path ):
76- permission = oct (os .stat (path ).st_mode )
77- self .assertEqual (permission , "0o100644" )
78- else :
79- checkFilePermissions (path )
80-
81- test_file_path = Path (__file__ )
82- # From tests/integration/test_job.py, go up 2 levels to project root, then to splunklib
83- splunklib_path = test_file_path .parent .parent .parent / "splunklib"
84- checkFilePermissions (str (splunklib_path ))
85-
86-
8761if __name__ == "__main__" :
8862 import unittest
8963
Original file line number Diff line number Diff line change 1+ import os
2+ from pathlib import Path
3+ import unittest
4+
5+
6+ class FilePermissionTest (unittest .TestCase ):
7+ def setUp (self ):
8+ super ().setUp ()
9+
10+ # Check for any change in the default file permission(i.e 644) for all files within splunklib
11+ def test_filePermissions (self ):
12+ def checkFilePermissions (dir_path ):
13+ for file in os .listdir (dir_path ):
14+ if file .__contains__ ("pycache" ):
15+ continue
16+ path = os .path .join (dir_path , file )
17+ if os .path .isfile (path ):
18+ permission = oct (os .stat (path ).st_mode )
19+ self .assertEqual (permission , "0o100644" )
20+ else :
21+ checkFilePermissions (path )
22+
23+ test_file_path = Path (__file__ )
24+ # From tests/unit/test_file_permissions.py, go up 2 levels to project root, then to splunklib
25+ splunklib_path = test_file_path .parent .parent .parent / "splunklib"
26+ checkFilePermissions (str (splunklib_path ))
27+
28+
29+ if __name__ == "__main__" :
30+ import unittest
31+
32+ unittest .main ()
You can’t perform that action at this time.
0 commit comments