def test_dir_subtract(self, root, child_dir, child_file, grand_child): with self.unchanged(child_dir, child_file, grand_child): root.chmod(mode=0o777) path_.chmod(root, 0o011, '-') path_.assert_mode(root, 0o766) path_.chmod(root, 0o271, '-') path_.assert_mode(root, 0o506)
def test_file_subtract(self, path, recursive): path.touch() path.chmod(0o777) path_.chmod(path, 0o111, '-', recursive=recursive) path_.assert_mode(path, 0o666) path_.chmod(path, 0o751, '-', recursive=recursive) path_.assert_mode(path, 0o026)
def test_dir_add(self, root, child_dir, child_file, grand_child): with self.unchanged(child_dir, child_file, grand_child): root.chmod(0o000) path_.chmod(root, 0o111, '+') path_.assert_mode(root, 0o111) path_.chmod(root, 0o100, '+') path_.assert_mode(root, 0o111) path_.chmod(root, 0o751, '+') path_.assert_mode(root, 0o751)
def test_file_add(self, path, recursive): path.touch() path.chmod(0o000) path_.chmod(path, 0o111, '+', recursive=recursive) path_.assert_mode(path, 0o111) path_.chmod(path, 0o100, '+', recursive=recursive) path_.assert_mode(path, 0o111) path_.chmod(path, 0o751, '+', recursive=recursive) path_.assert_mode(path, 0o751)
def test_dir_subtract_recursive(self, root, child_dir, child_file, grand_child): root.chmod(mode=0o777) child_dir.chmod(0o777) child_file.chmod(0o777) grand_child.chmod(0o777) path_.chmod(root, 0o222, '-', recursive=True) path_.assert_mode(root, 0o555) path_.assert_mode(child_dir, 0o555) path_.assert_mode(child_file, 0o555) path_.assert_mode(grand_child, 0o555) path_.chmod(root, 0o047, '-', recursive=True) path_.assert_mode(root, 0o510) path_.assert_mode(child_dir, 0o510) path_.assert_mode(child_file, 0o511) path_.assert_mode(grand_child, 0o511)
def test_dir_add_recursive(self, root, child_dir, child_file, grand_child): grand_child.chmod(0o000) child_dir.chmod(0o000) child_file.chmod(0o000) root.chmod(0o000) path_.chmod(root, 0o511, '+', recursive=True) path_.assert_mode(root, 0o511) path_.assert_mode(child_dir, 0o511) path_.assert_mode(child_file, 0o400) path_.assert_mode(grand_child, 0o400) path_.chmod(root, 0o500, '+', recursive=True) path_.assert_mode(root, 0o511) path_.assert_mode(child_dir, 0o511) path_.assert_mode(child_file, 0o400) path_.assert_mode(grand_child, 0o400) path_.chmod(root, 0o751, '+', recursive=True) path_.assert_mode(root, 0o751) path_.assert_mode(child_dir, 0o751) path_.assert_mode(child_file, 0o640) path_.assert_mode(grand_child, 0o640)
def test_dir_assign_recursive(self, root, child_dir, child_file, grand_child): path_.chmod(root, mode=0o777, recursive=True) path_.assert_mode(root, 0o777) path_.assert_mode(child_dir, 0o777) path_.assert_mode(child_file, 0o666) path_.assert_mode(grand_child, 0o666) path_.chmod(root, mode=0o751, recursive=True) path_.assert_mode(root, 0o751) path_.assert_mode(child_dir, 0o751) path_.assert_mode(child_file, 0o640) path_.assert_mode(grand_child, 0o640)
def test_dir_assign(self, root, child_dir, child_file, grand_child): with self.unchanged(child_dir, child_file, grand_child): path_.chmod(root, mode=0o777) path_.assert_mode(root, 0o777) path_.chmod(root, mode=0o751) path_.assert_mode(root, 0o751)
def test_file_assign(self, path, recursive): path.touch() path_.chmod(path, mode=0o777, recursive=recursive) path_.assert_mode(path, 0o777) path_.chmod(path, mode=0o751, recursive=recursive) path_.assert_mode(path, 0o751)