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
def it_doesnt_allow_writable_by_others(self, testfile): testfile.chmod(0o446) assert configsearch.any_insecure_path_segment( testfile.strpath) == testfile.strpath
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
def it_allows_writable_by_owner(self, testfile): testfile.chmod(0o644) assert configsearch.any_insecure_path_segment(testfile.strpath) is None
def it_allows_minimal_permissions(self, testfile): testfile.chmod(0o000) assert configsearch.any_insecure_path_segment(testfile.strpath) is None
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
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
def it_doesnt_allow_writable_by_others(self, testfile): testfile.chmod(0o446) assert configsearch.any_insecure_path_segment(testfile.strpath) == testfile.strpath
def it_allows_minimal_permissions(self, testfile): testfile.chmod(0o000) assert configsearch.any_insecure_path_segment(testfile.strpath) is None
def it_allows_writable_by_owner(self, testfile): testfile.chmod(0o644) assert configsearch.any_insecure_path_segment(testfile.strpath) is None