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