/usr/lib/python2.7/dist-packages/schooltool/gradebook/browser/stests/gradebook_tab.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 | Gradebook tab
=============
We'll test that the Gradebook tab redirect teachers only to sections
they teach.
Helper:
>>> def print_section_navigator(browser):
... sel = 'select[name="currentSection"] option'
... for option in browser.query_all.css(sel):
... print ['%s', '*%s*'][option.is_selected()] % option.text
Log in as manager:
>>> manager = browsers.manager
>>> manager.ui.login('manager', 'schooltool')
Set up persons:
>>> manager.ui.person.add('Tom', 'Hoffman', 'tom', 'pwd')
>>> manager.ui.person.add('Jeffrey', 'Elkner', 'jeffrey', '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')
>>> manager.ui.person.add('Liliana', 'Vividor', 'liliana', 'pwd')
>>> manager.ui.person.add('German', 'Tejada', 'german', 'pwd')
Set up some courses with a section each:
>>> manager.ui.schoolyear.add('2013', '2013-01-01', '2013-12-31')
>>> manager.ui.term.add('2013', 'Year', '2013-01-01', '2013-12-31')
>>> manager.ui.course.add('2013', 'Math')
>>> manager.ui.course.add('2013', 'Physics')
>>> manager.ui.course.add('2013', 'Algebra')
>>> manager.ui.course.add('2013', 'Baseball')
>>> manager.ui.course.add('2013', 'Soccer')
>>> manager.ui.course.add('2013', 'Swimming')
>>> manager.ui.section.add('2013', 'Year', 'Algebra')
>>> manager.ui.section.add('2013', 'Year', 'Math')
>>> manager.ui.section.add('2013', 'Year', 'Physics')
>>> manager.ui.section.add('2013', 'Year', 'Baseball')
>>> manager.ui.section.add('2013', 'Year', 'Soccer')
>>> manager.ui.section.add('2013', 'Year', 'Swimming')
>>> for section in ['Algebra (1)', 'Math (2)', 'Physics (3)']:
... manager.ui.section.instructors.add('2013', 'Year', section,
... ['jeffrey'])
... manager.ui.section.students.add('2013', 'Year', section,
... ['camila', 'mario', 'nestor'])
>>> for section in ['Baseball (4)', 'Soccer (5)', 'Swimming (6)']:
... manager.ui.section.instructors.add('2013', 'Year', section,
... ['tom'])
... manager.ui.section.students.add('2013', 'Year', section,
... ['liliana', 'german'])
Log in as teacher:
>>> teacher = browsers.teacher
>>> teacher.ui.login('jeffrey', 'pwd')
Click the Gradebook tab:
>>> teacher.query.link('Gradebook').click()
List the sections navigator:
>>> print_section_navigator(teacher)
*Algebra (1)*
Math (2)
Physics (3)
Switch to the Math (2) section and list the sections navigator again:
>>> navigator = teacher.query_all.css('.refine .navigator')[0]
>>> page = teacher.query.tag('html')
>>> navigator.ui.set_value('Math (2)')
>>> teacher.wait(lambda: page.expired)
>>> print_section_navigator(teacher)
Algebra (1)
*Math (2)*
Physics (3)
Go to Home page and back to the Gradebook tab. Current section should
be Math (2):
>>> teacher.query.link('Home').click()
>>> teacher.query.link('Gradebook').click()
>>> print_section_navigator(teacher)
Algebra (1)
*Math (2)*
Physics (3)
Add teacher to the School Administrators group:
>>> manager.ui.group.members.add('2013', 'School Administrators',
... ['jeffrey'])
This gives the teacher ability to see other teachers' gradebooks:
>>> teacher.ui.section.go('2013', 'Year', 'Baseball (4)')
>>> sel = '//div[contains(@class, "sidebar")]//a[text()="Gradebook"]'
>>> teacher.query.xpath(sel).click()
>>> teacher.ui.gradebook.worksheet.pprint()
+----------+
| *Sheet1* |
+----------+
+-----------+------------+-------+------+
| Last Name | First Name | Total | Ave. |
| | | | |
+-----------+------------+-------+------+
| Tejada | German | 0.0 | N/A |
| Vividor | Liliana | 0.0 | N/A |
+-----------+------------+-------+------+
Go to Home page and back to the Gradebook tab. Again, the current
section should be Math (2), not Baseball (4):
>>> teacher.query.link('Home').click()
>>> teacher.query.link('Gradebook').click()
>>> print_section_navigator(teacher)
Algebra (1)
*Math (2)*
Physics (3)
Let's repeat this whole process for a student. Log in as student:
>>> student = browsers.student
>>> student.ui.login('camila', 'pwd')
Click the Gradebook tab:
>>> student.query.link('Gradebook').click()
List the sections navigator:
>>> print_section_navigator(student)
*Algebra (1)*
Math (2)
Physics (3)
Switch to the Math (2) section and list the sections navigator again:
>>> navigator = student.query_all.css('.refine .navigator')[0]
>>> page = student.query.tag('html')
>>> navigator.ui.set_value('Math (2)')
>>> student.wait(lambda: page.expired)
>>> print student.query.tag('h3').text
Nothing Graded
>>> print_section_navigator(student)
Algebra (1)
*Math (2)*
Physics (3)
Go to Home page and back to the Gradebook tab. Current section should
be Math (2):
>>> student.query.link('Home').click()
>>> student.query.link('Gradebook').click()
>>> print student.query.tag('h3').text
Nothing Graded
>>> print_section_navigator(student)
Algebra (1)
*Math (2)*
Physics (3)
Add student to the School Administrators group:
>>> manager.ui.group.members.add('2013', 'School Administrators',
... ['camila'])
This gives the gradebook ability to see other section gradebooks:
>>> student.ui.section.go('2013', 'Year', 'Baseball (4)')
>>> sel = '//div[contains(@class, "sidebar")]//a[text()="Gradebook"]'
>>> student.query.xpath(sel).click()
>>> student.ui.gradebook.worksheet.pprint()
+----------+
| *Sheet1* |
+----------+
+-----------+------------+-------+------+
| Last Name | First Name | Total | Ave. |
| | | | |
+-----------+------------+-------+------+
| Tejada | German | 0.0 | N/A |
| Vividor | Liliana | 0.0 | N/A |
+-----------+------------+-------+------+
Go to Home page and back to the Gradebook tab. Again, the current
section should be Math (2), not Baseball (4):
>>> student.query.link('Home').click()
>>> student.query.link('Gradebook').click()
>>> print student.query.tag('h3').text
Nothing Graded
>>> print_section_navigator(student)
Algebra (1)
*Math (2)*
Physics (3)
|