This file is indexed.

/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/stests/selenium_extensions.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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
Selenium browser extensions tests
=================================

Let's test the selenium extensions created in the
schooltool.gradebook.stesting module.

See the README.selenium.txt file in the
schooltool/gradebook/browser/stests directory for instructions on how
to use them.

Log in as manager:

    >>> manager = browsers.manager
    >>> manager.ui.login('manager', 'schooltool')

Add a school year:

    >>> manager.ui.schoolyear.add('2012', '2012-01-01', '2012-12-31')

Add a term:

    >>> manager.ui.term.add('2012', 'Single Year', '2012-01-01', '2012-12-31')

Add some people:

    >>> manager.ui.person.add('Tom', 'Hoffman', 'tom', 'pwd')
    >>> manager.ui.person.add('Camila', 'Cerna', 'camila', 'pwd')
    >>> manager.ui.person.add('Mario', 'Tejada', 'mario', 'pwd')
    >>> manager.ui.person.add('Nestor', 'Guzman', 'nestor', 'pwd')

Add a course:

    >>> manager.ui.course.add('2012', 'Baseball')

Add a section:

    >>> manager.ui.section.add('2012', 'Single Year', 'Baseball')

with instructor:

    >>> manager.ui.section.instructors.add('2012', 'Single Year',
    ...                                    'Baseball (1)', ['tom'])

and students:

    >>> manager.ui.section.students.add('2012', 'Single Year',
    ...                                 'Baseball (1)',
    ...                                 ['camila', 'mario', 'nestor'])


browser.ui.worksheet.score()
----------------------------

Used for scoring an activity for a student.

Let's login as the instructor:

    >>> teacher = browsers.teacher
    >>> teacher.ui.login('tom', 'pwd')

and visit the gradebook of the section:

    >>> teacher.ui.section.go('2012', 'Single Year', 'Baseball (1)')
    >>> teacher.query.css('.sidebar').query.link('Gradebook').click();

The student titles are shown in the default worksheet:

    >>> for link in teacher.query_all.css('.students tbody td:first-child a.popup_link'):
    ...     print link.get_attribute('title')
    Camila Cerna
    Nestor Guzman
    Mario Tejada

Let's add some activities to the default worksheet:

    >>> teacher.query.link('Activity').click()
    >>> teacher.query.id('form-widgets-title').type('Pitching')
    >>> teacher.query.id('form-widgets-label').type('PITCH')
    >>> teacher.query.button('Submit').click()

    >>> teacher.query.link('Activity').click()
    >>> teacher.query.id('form-widgets-title').type('Batting')
    >>> teacher.query.id('form-widgets-label').type('BAT')
    >>> teacher.query.button('Submit').click()

    >>> teacher.query.link('Activity').click()
    >>> teacher.query.id('form-widgets-title').type('Swing')
    >>> teacher.query.button('Submit').click()

    >>> teacher.query.link('Activity').click()
    >>> teacher.query.id('form-widgets-title').type('Running bases')
    >>> teacher.query.id('form-widgets-label').type('RUNNING')
    >>> teacher.query.button('Submit').click()

The activity labels are shown in the worksheet:

    >>> for link in teacher.query_all.css('.grades thead a.popup_link'):
    ...     print link.text
    PITCH
    BAT
    Swing
    RUNNI

Now we can grade the activities using the student title and the
activity label:

    >>> teacher.ui.gradebook.worksheet.score('Camila Cerna', 'PITCH', '90')
    >>> teacher.ui.gradebook.worksheet.score('Camila Cerna', 'BAT', '60')
    >>> teacher.ui.gradebook.worksheet.score('Camila Cerna', 'Swing', '90')

    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'PITCH', '100')
    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'BAT', '70')
    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'Swing', '85')

    >>> teacher.ui.gradebook.worksheet.score('Mario Tejada', 'PITCH', '70')
    >>> teacher.ui.gradebook.worksheet.score('Mario Tejada', 'BAT', '60')
    >>> teacher.ui.gradebook.worksheet.score('Mario Tejada', 'Swing', '75')

    >>> teacher.query.button('Save').click()

We'll check that our changes were correctly saved using our next
browser extension.


browser.ui.worksheet.pprint()
-----------------------------

Used for printing the current worksheet.

Let's add a second worksheet and print it:

    >>> teacher.query.link('Worksheet').click()
    >>> teacher.query.id('form-widgets-title').type('Coaching')
    >>> teacher.query.button('Submit').click()
    >>> teacher.ui.gradebook.worksheet.pprint()
    +--------+------------+
    | Sheet1 | *Coaching* |
    +--------+------------+
    +-----------+------------+-------+------+
    | Last Name | First Name | Total | Ave. |
    |           |            |       |      |
    +-----------+------------+-------+------+
    | Cerna     | Camila     | 0.0   | N/A  |
    | Guzman    | Nestor     | 0.0   | N/A  |
    | Tejada    | Mario      | 0.0   | N/A  |
    +-----------+------------+-------+------+

Let's go back to the first worksheet, and print it:

    >>> teacher.query.link('Sheet1').click()
    >>> teacher.ui.gradebook.worksheet.pprint()
    +----------+----------+
    | *Sheet1* | Coaching |
    +----------+----------+
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Last Name | First Name | PITCH | BAT | Swing | RUNNI | Total | Ave.  |
    |           |            | 100   | 100 | 100   | 100   |       |       |
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Cerna     | Camila     | 90    | 60  | 90    |       | 240.0 | 80.0% |
    | Guzman    | Nestor     | 100   | 70  | 85    |       | 255.0 | 85.0% |
    | Tejada    | Mario      | 70    | 60  | 75    |       | 205.0 | 68.3% |
    +-----------+------------+-------+-----+-------+-------+-------+-------+

Let's change some scores:

    >>> teacher.ui.gradebook.worksheet.score('Camila Cerna', 'PITCH', '')
    >>> teacher.ui.gradebook.worksheet.score('Camila Cerna', 'Swing', '85')

    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'PITCH', '-90')
    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'BAT', '20')

    >>> teacher.ui.gradebook.worksheet.score('Mario Tejada', 'PITCH', '0')
    >>> teacher.ui.gradebook.worksheet.score('Mario Tejada', 'Swing', '120')

and print the gradebook before saving the changes to see the input
fields:

    >>> teacher.ui.gradebook.worksheet.pprint()
    +----------+----------+
    | *Sheet1* | Coaching |
    +----------+----------+
    +-----------+------------+---------+---------+---------+-------+-------+-------+
    | Last Name | First Name | PITCH   | BAT     | Swing   | RUNNI | Total | Ave.  |
    |           |            | 100     | 100     | 100     | 100   |       |       |
    +-----------+------------+---------+---------+---------+-------+-------+-------+
    | Cerna     | Camila     | [_____] | 60      | [85___] |       | 240.0 | 80.0% |
    | Guzman    | Nestor     | [-90__] | [20___] | 85      |       | 255.0 | 85.0% |
    | Tejada    | Mario      | [0____] | 60      | [120__] |       | 205.0 | 68.3% |
    +-----------+------------+---------+---------+---------+-------+-------+-------+

We can also print validation codes. The letters next to each input
field mean:

* v: valid score
* e: extra credit score
* i: invalid score

    >>> teacher.ui.gradebook.worksheet.pprint(show_validation=True)
    +----------+----------+
    | *Sheet1* | Coaching |
    +----------+----------+
    +-----------+------------+----------+----------+----------+-------+-------+-------+
    | Last Name | First Name | PITCH    | BAT      | Swing    | RUNNI | Total | Ave.  |
    |           |            | 100      | 100      | 100      | 100   |       |       |
    +-----------+------------+----------+----------+----------+-------+-------+-------+
    | Cerna     | Camila     | [_____]v | 60       | [85___]v |       | 240.0 | 80.0% |
    | Guzman    | Nestor     | [-90__]i | [20___]v | 85       |       | 255.0 | 85.0% |
    | Tejada    | Mario      | [0____]v | 60       | [120__]e |       | 205.0 | 68.3% |
    +-----------+------------+----------+----------+----------+-------+-------+-------+

After fixing the invalid scores and saving the changes, the totals and
averages are recalculated:

    >>> teacher.ui.gradebook.worksheet.score('Nestor Guzman', 'PITCH', '90')
    >>> teacher.query.button('Save').click()
    >>> teacher.ui.gradebook.worksheet.pprint()
    +----------+----------+
    | *Sheet1* | Coaching |
    +----------+----------+
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Last Name | First Name | PITCH | BAT | Swing | RUNNI | Total | Ave.  |
    |           |            | 100   | 100 | 100   | 100   |       |       |
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Cerna     | Camila     |       | 60  | 85    |       | 145.0 | 72.5% |
    | Guzman    | Nestor     | 90    | 20  | 85    |       | 195.0 | 65.0% |
    | Tejada    | Mario      | 0     | 60  | 120   |       | 180.0 | 60.0% |
    +-----------+------------+-------+-----+-------+-------+-------+-------+

If we print the worksheet with the validation flag set, but there are
no input fields, we get the same output:

    >>> teacher.ui.gradebook.worksheet.pprint(show_validation=True)
    +----------+----------+
    | *Sheet1* | Coaching |
    +----------+----------+
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Last Name | First Name | PITCH | BAT | Swing | RUNNI | Total | Ave.  |
    |           |            | 100   | 100 | 100   | 100   |       |       |
    +-----------+------------+-------+-----+-------+-------+-------+-------+
    | Cerna     | Camila     |       | 60  | 85    |       | 145.0 | 72.5% |
    | Guzman    | Nestor     | 90    | 20  | 85    |       | 195.0 | 65.0% |
    | Tejada    | Mario      | 0     | 60  | 120   |       | 180.0 | 60.0% |
    +-----------+------------+-------+-----+-------+-------+-------+-------+