Beispiel #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
Beispiel #2
0
 def it_doesnt_allow_writable_by_others(self, testfile):
     testfile.chmod(0o446)
     assert configsearch.any_insecure_path_segment(
         testfile.strpath) == testfile.strpath
Beispiel #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
Beispiel #4
0
 def it_allows_writable_by_owner(self, testfile):
     testfile.chmod(0o644)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
Beispiel #5
0
 def it_allows_minimal_permissions(self, testfile):
     testfile.chmod(0o000)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
Beispiel #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
Beispiel #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
Beispiel #8
0
 def it_doesnt_allow_writable_by_others(self, testfile):
     testfile.chmod(0o446)
     assert configsearch.any_insecure_path_segment(testfile.strpath) == testfile.strpath
Beispiel #9
0
 def it_allows_minimal_permissions(self, testfile):
     testfile.chmod(0o000)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None
Beispiel #10
0
 def it_allows_writable_by_owner(self, testfile):
     testfile.chmod(0o644)
     assert configsearch.any_insecure_path_segment(testfile.strpath) is None