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