This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/ftests/worksheet_hiding.txt is in python-schooltool.gradebook 2.6.3-0ubuntu1.

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
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
Hiding Worksheets
-----------------

We want to allow the user to hide a worksheet so that it no longer figures in
the gradebook.  The worksheet will not be deleted from the database, but it
will be ignored in all areas of gradebook management.

Import helper to print the gradebook:

    >>> from schooltool.gradebook.browser.ftests import printGradebook

Log in as manager:

    >>> manager = Browser('manager', 'schooltool')

Now, set up a school year (2005-2006) with two terms (Fall and
Spring):

    >>> from schooltool.app.browser.ftests import setup
    >>> setup.setUpBasicSchool()

Set up one courses:

    >>> setup.addCourse('Math I', '2005-2006')

Set up persons:

    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
    >>> addPerson('Paul', 'Carduner', 'paul', 'pwd', browser=manager)
    >>> addPerson('Tom', 'Hoffman', 'tom', 'pwd', browser=manager)
    >>> addPerson('Claudia', 'Richter', 'claudia', 'pwd', browser=manager)
    >>> addPerson('Stephan', 'Richter', 'stephan', 'pwd', browser=manager)

Set up one section with instructor and students:

    >>> setup.addSection('Math I', '2005-2006', 'Fall',
    ...                  instructors=['Stephan'],
    ...                  members=['Tom', 'Claudia', 'Paul'])

Log in as teacher:

    >>> stephan = Browser('stephan', 'pwd')

Add a couple of activities to the default worksheet:

    >>> stephan.getLink('Gradebook').click()
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
    2005-2006 / Fall
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
    Math I - Math I (1)
    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+-------+------+
    | Name            | Total | Ave. |
    +-----------------+-------+------+
    | Paul Carduner   | 0.0   | N/A  |
    | Tom Hoffman     | 0.0   | N/A  |
    | Claudia Richter | 0.0   | N/A  |
    +-----------------+-------+------+

    >>> stephan.getLink('New Activity').click()
    >>> stephan.getControl('Title').value = 'HW 1'
    >>> stephan.getControl('Description').value = 'Homework 1'
    >>> stephan.getControl('Category').displayValue = ['Assignment']
    >>> stephan.getControl('Maximum').value = '50'
    >>> stephan.getControl('Add').click()

    >>> stephan.getLink('New Activity').click()
    >>> stephan.getControl('Title').value = 'Quiz'
    >>> stephan.getControl('Description').value = 'Week 1 Pop Quiz'
    >>> stephan.getControl('Category').displayValue = ['Exam']
    >>> stephan.getControl('Add').click()

We'll add a new worksheet called 'Second Sheet' and note its presence
in the list.

    >>> stephan.getLink('Worksheets').click()
    >>> stephan.getLink('New Worksheet').click()
    >>> stephan.getControl('Title').value = 'Second Sheet'
    >>> stephan.getControl('Add').click()
    >>> stephan.printQuery('//h1')
    <h1>Worksheets</h1>
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
    Sheet1
    Second Sheet

We'll make it the user's current worksheet to make sure we can handle hiding
a worksheet that happens to be the current one for the user.

    >>> stephan.getLink('Return to Gradebook').click()
    >>> stephan.getLink('Second Sheet').click()
    >>> printGradebook(stephan.contents)
    +--------+----------------+
    | Sheet1 | *Second Sheet* |
    +--------+----------------+
    +-----------------+-------+------+
    | Name            | Total | Ave. |
    +-----------------+-------+------+
    | Paul Carduner   | 0.0   | N/A  |
    | Tom Hoffman     | 0.0   | N/A  |
    | Claudia Richter | 0.0   | N/A  |
    +-----------------+-------+------+

Now we'll hide our newly added worksheet, noting its absense from the list.

    >>> stephan.getLink('Worksheets').click()
    >>> stephan.getControl(name='hide:list').value = ['Worksheet-2']
    >>> stephan.getControl('Hide').click()
    >>> stephan.printQuery('//h1')
    <h1>Worksheets</h1>
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
    Sheet1

Finally, we'll return to the gradebook, noting that it handles the current
worksheet being hidden, changing the current worksheet to the first one that
is not hidden.

    >>> stephan.getLink('Return to Gradebook').click()
    >>> printGradebook(stephan.contents)
    +----------+
    | *Sheet1* |
    +----------+
    +-----------------+-------+------+---------+---------+
    | Name            | Total | Ave. | HW1     | Quiz    |
    +-----------------+-------+------+---------+---------+
    | Paul Carduner   | 0.0   | N/A  | [_____] | [_____] |
    | Tom Hoffman     | 0.0   | N/A  | [_____] | [_____] |
    | Claudia Richter | 0.0   | N/A  | [_____] | [_____] |
    +-----------------+-------+------+---------+---------+


Unhiding Worksheets
~~~~~~~~~~~~~~~~~~~

Now that we can hide worksheets, we need to allow the user to change
their mind and unhide a worksheet they previously hid.  We need to
navigate to the worksheets from which we can call up the view for
unhiding worksheets.

    >>> stephan.getLink('Worksheets').click()
    >>> stephan.getLink('Unhide Worksheets').click()
    >>> stephan.printQuery('//h1/text()')
    Unhide Worksheets
    >>> stephan.printQuery('//form//table/tr/td[2]/span/text()')
    Second Sheet

We'll choose the worksheet we just hid and hit the Unhide button.  The
view automatically returns to the worksheets view.  There we see that
the worksheet has reappeared in the worksheets list.

    >>> stephan.getControl(name='unhide:list').value = ['Worksheet-2']
    >>> stephan.getControl('Unhide').click()
    >>> stephan.printQuery('//h1')
    <h1>Worksheets</h1>
    >>> stephan.printQuery('//form//table/tr/td[3]/a/text()')
    Sheet1
    Second Sheet

We'll return to the gradebook to see both worksheets:

    >>> stephan.getLink('Return to Gradebook').click()
    >>> printGradebook(stephan.contents)
    +----------+--------------+
    | *Sheet1* | Second Sheet |
    +----------+--------------+
    +-----------------+-------+------+---------+---------+
    | Name            | Total | Ave. | HW1     | Quiz    |
    +-----------------+-------+------+---------+---------+
    | Paul Carduner   | 0.0   | N/A  | [_____] | [_____] |
    | Tom Hoffman     | 0.0   | N/A  | [_____] | [_____] |
    | Claudia Richter | 0.0   | N/A  | [_____] | [_____] |
    +-----------------+-------+------+---------+---------+