示例#1
0
 def it_does_allow_readonly_by_wrong_owner(self, testfile):
     import mock
     import os
     with mock.patch.object(os, 'getuid', lambda: None):
         assert configsearch.any_insecure_path_segment(
             testfile.strpath) == testfile.strpath
示例#2
0
 def it_doesnt_allow_writable_by_others(self, testfile):
     testfile.chmod(0o446)
     assert configsearch.any_insecure_path_segment(
         testfile.strpath) == testfile.strpath
示例#3
0
 def it_doesnt_allow_directory_writable_by_others(self, testfile):
     parentdir = testfile.join('../..')
     parentdir.chmod(0o757)
     assert configsearch.any_insecure_path_segment(
         testfile.strpath) == parentdir.strpath
示例#4
0
 def it_allows_writable_by_owner(self, testfile):
     testfile.chmod(0o644)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
示例#5
0
 def it_allows_minimal_permissions(self, testfile):
     testfile.chmod(0o000)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
示例#6
0
 def it_does_allow_readonly_by_wrong_owner(self, testfile):
     import mock
     import os
     with mock.patch.object(os, 'getuid', lambda: None):
         assert configsearch.any_insecure_path_segment(testfile.strpath) == testfile.strpath
示例#7
0
 def it_doesnt_allow_directory_writable_by_others(self, testfile):
     parentdir = testfile.join('../..')
     parentdir.chmod(0o757)
     assert configsearch.any_insecure_path_segment(testfile.strpath) == parentdir.strpath
示例#8
0
 def it_doesnt_allow_writable_by_others(self, testfile):
     testfile.chmod(0o446)
     assert configsearch.any_insecure_path_segment(testfile.strpath) == testfile.strpath
示例#9
0
 def it_allows_minimal_permissions(self, testfile):
     testfile.chmod(0o000)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
示例#10
0
 def it_allows_writable_by_owner(self, testfile):
     testfile.chmod(0o644)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None