/usr/lib/python2.7/dist-packages/schooltool/lyceum/journal/stests/journal_tab.txt is in python-schooltool.lyceum.journal 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 | Journal tab
===========
We'll test that the Journal 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'])
Add a timetable:
>>> manager.query.link('School').click()
>>> manager.query.link('Timetables').click()
>>> manager.query.link('Timetable').click()
>>> manager.query.button('Next').click()
>>> manager.query.button('Days of the week').click()
>>> manager.query.button('Same time each day').click()
>>> times = '9:30-10:25\n10:30-11:25\n11:30-12:25'
>>> manager.query.id('field.times').clear()
>>> manager.query.id('field.times').ui.set_value(times)
>>> manager.query.button('Next').click()
>>> manager.query.button('Designated by time').click()
>>> manager.query.button('No').click()
Set a schedule for some sections:
>>> sel = '//div[contains(@class, "sidebar")]//a[text()="Schedule"]'
>>> for i, section in enumerate(['Algebra (1)', 'Math (2)', 'Baseball (4)']):
... manager.ui.section.go('2013', 'Year', section)
... manager.query.link('Schedule').click()
... manager.query.xpath(sel).click()
... manager.query.button('Submit').click()
... period = 'Period-'
... if i > 0:
... period = 'Period-%d-' % (i + 1)
... manager.query.xpath('//input[@name="period.0-.%s"]' % period).click()
... manager.query.xpath('//input[@name="period.1-.%s"]' % period).click()
... manager.query.xpath('//input[@name="period.2-.%s"]' % period).click()
... manager.query.xpath('//input[@name="period.3-.%s"]' % period).click()
... manager.query.xpath('//input[@name="period.4-.%s"]' % period).click()
... manager.query.button('Save').click()
Log in as teacher:
>>> teacher = browsers.teacher
>>> teacher.ui.login('jeffrey', 'pwd')
Click the Journal tab:
>>> teacher.query.link('Journal').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 Journal tab. Current section should
be Math (2):
>>> teacher.query.link('Home').click()
>>> teacher.query.link('Journal').click()
>>> print_section_navigator(teacher)
Algebra (1)
*Math (2)*
Physics (3)
Add teacher to the Clerks group:
>>> manager.ui.group.members.add('2013', 'Clerks',
... ['jeffrey'])
This gives the teacher ability to see other teachers' journals:
>>> teacher.ui.section.go('2013', 'Year', 'Baseball (4)')
>>> sel = '//div[contains(@class, "sidebar")]//a[text()="Journal"]'
>>> teacher.query.xpath(sel).click()
>>> print teacher.url
http://localhost/schoolyears/2013/year/sections/4/journal
Go to Home page and back to the Journal tab. Again, the current
section should be Math (2), not Baseball (4):
>>> teacher.query.link('Home').click()
>>> teacher.query.link('Journal').click()
>>> print_section_navigator(teacher)
Algebra (1)
*Math (2)*
Physics (3)
|