This file is indexed.

/usr/lib/python2.7/dist-packages/openpyxl/worksheet/tests/test_protection.py is in python-openpyxl 2.3.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import absolute_import
# Copyright (c) 2010-2015 openpyxl

import pytest
from openpyxl.tests.helper import compare_xml

from openpyxl.xml.functions import tostring
from .. protection import SheetProtection, hash_password


def test_password():
    enc = hash_password('secret')
    assert enc == 'DAA7'


def test_ctor():
    prot = SheetProtection()
    xml = tostring(prot.to_tree())
    expected = """
    <sheetProtection
        autoFilter="1" deleteColumns="1" deleteRows="1" formatCells="1"
        formatColumns="1" formatRows="1" insertColumns="1" insertHyperlinks="1"
        insertRows="1" objects="0" pivotTables="1" scenarios="0"
        selectLockedCells="0" selectUnlockedCells="0" sheet="0" sort="1" />
    """
    diff = compare_xml(xml, expected)
    assert diff is None, diff


def test_ctor_with_password():
    prot = SheetProtection(password="secret")
    assert prot.password == "DAA7"


@pytest.mark.parametrize("password, already_hashed, value",
                         [
                             ('secret', False, 'DAA7'),
                             ('secret', True, 'secret'),
                         ])
def test_explicit_password(password, already_hashed, value):
    prot = SheetProtection()
    prot.set_password(password, already_hashed)
    assert prot.password == value
    assert prot.sheet == True