~ubuntu-branches/ubuntu/natty/schooltool.gradebook/natty

« back to all changes in this revision

Viewing changes to src/schooltool/gradebook/browser/ftests/last_visited_section.txt

  • Committer: Bazaar Package Importer
  • Author(s): Gediminas Paulauskas
  • Date: 2011-02-24 16:53:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110224165353-hi69ckyal3b8dyns
Tags: upstream-0.9.0~a1
ImportĀ upstreamĀ versionĀ 0.9.0~a1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Last visited section tests
 
2
--------------------------
 
3
 
 
4
The gradebook remembers where a teacher or student was last time they were
 
5
in the gradebook, so we will test this.
 
6
 
 
7
Log in as manager:
 
8
 
 
9
    >>> manager = Browser('manager', 'schooltool')
 
10
 
 
11
Now, set up a school year (2005-2006) with two terms (Fall and
 
12
Spring):
 
13
 
 
14
    >>> from schooltool.app.browser.ftests import setup
 
15
    >>> setup.setUpBasicSchool()
 
16
 
 
17
Set up one course:
 
18
 
 
19
    >>> setup.addCourse('Physics I', '2005-2006')
 
20
 
 
21
Set up persons:
 
22
 
 
23
    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
 
24
    >>> addPerson('Paul', 'Cardune', 'paul', 'pwd', browser=manager)
 
25
    >>> addPerson('Tom', 'Hoffman', 'tom', 'pwd', browser=manager)
 
26
    >>> addPerson('Claudia', 'Richter', 'claudia', 'pwd', browser=manager)
 
27
    >>> addPerson('Stephan', 'Richter', 'stephan', 'pwd', browser=manager)
 
28
 
 
29
Set up one section with instructor and students for each term:
 
30
 
 
31
    >>> setup.addSection('Physics I', '2005-2006', 'Fall',
 
32
    ...                  instructors=['Stephan'],
 
33
    ...                  members=['Tom', 'Claudia', 'Paul'])
 
34
    >>> setup.addSection('Physics I', '2005-2006', 'Spring',
 
35
    ...                  instructors=['Stephan'],
 
36
    ...                  members=['Tom', 'Claudia', 'Paul'])
 
37
 
 
38
Log in as teacher:
 
39
 
 
40
    >>> stephan = Browser('stephan', 'pwd')
 
41
 
 
42
Add a couple of activities to the default worksheet:
 
43
 
 
44
    >>> stephan.getLink('Gradebook').click()
 
45
    >>> url = stephan.url
 
46
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
47
    2005-2006 / Fall
 
48
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
49
    Physics I - Physics I (1)
 
50
 
 
51
    >>> stephan.getLink('New Activity').click()
 
52
    >>> stephan.getControl('Title').value = 'HW 1'
 
53
    >>> stephan.getControl('Description').value = 'Homework 1'
 
54
    >>> stephan.getControl('Category').value = ['assignment']
 
55
    >>> stephan.getControl('Maximum').value = '50'
 
56
    >>> stephan.getControl('Add').click()
 
57
 
 
58
    >>> stephan.getLink('New Activity').click()
 
59
    >>> stephan.getControl('Title').value = 'Quiz'
 
60
    >>> stephan.getControl('Description').value = 'Week 1 Pop Quiz'
 
61
    >>> stephan.getControl('Category').value = ['exam']
 
62
    >>> stephan.getControl('Add').click()
 
63
 
 
64
Add some grades:
 
65
 
 
66
    >>> stephan.getControl(name='Activity_paul').value = '40'
 
67
    >>> stephan.getControl(name='Activity_tom').value = '48'
 
68
    >>> stephan.getControl(name='Activity_claudia').value = '45'
 
69
 
 
70
    >>> stephan.getControl(name='Activity-2_paul').value = '90'
 
71
    >>> stephan.getControl(name='Activity-2_tom').value = '88'
 
72
    >>> stephan.getControl(name='Activity-2_claudia').value = '29'
 
73
 
 
74
    >>> stephan.getControl('Save').click()
 
75
 
 
76
    >>> stephan.url
 
77
    'http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/gradebook'
 
78
 
 
79
Change to the other section and add some activities and grades:
 
80
 
 
81
    >>> stephan.open(url+'?currentTerm=2005-2006-.spring-')
 
82
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
83
    2005-2006 / Spring
 
84
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
85
    Physics I - Physics I (1)
 
86
 
 
87
    >>> stephan.getLink('New Activity').click()
 
88
    >>> stephan.getControl('Title').value = 'HW 1'
 
89
    >>> stephan.getControl('Description').value = 'Homework 2'
 
90
    >>> stephan.getControl('Category').value = ['assignment']
 
91
    >>> stephan.getControl('Add').click()
 
92
 
 
93
    >>> stephan.getLink('New Activity').click()
 
94
    >>> stephan.getControl('Title').value = 'Quiz'
 
95
    >>> stephan.getControl('Description').value = 'Spring Pop Quiz'
 
96
    >>> stephan.getControl('Category').value = ['exam']
 
97
    >>> stephan.getControl('Add').click()
 
98
 
 
99
    >>> stephan.getControl(name='Activity_paul').value = '80'
 
100
    >>> stephan.getControl(name='Activity_tom').value = '95'
 
101
    >>> stephan.getControl(name='Activity_claudia').value = '85'
 
102
 
 
103
    >>> stephan.getControl(name='Activity-2_paul').value = '90'
 
104
    >>> stephan.getControl(name='Activity-2_tom').value = '88'
 
105
    >>> stephan.getControl(name='Activity-2_claudia').value = '79'
 
106
 
 
107
    >>> stephan.getControl('Save').click()
 
108
 
 
109
    >>> stephan.url
 
110
    'http://localhost/schoolyears/2005-2006/spring/sections/1/activities/Worksheet/gradebook'
 
111
    >>> stephan.getLink('Gradebook').click()
 
112
    >>> stephan.url
 
113
    'http://localhost/schoolyears/2005-2006/spring/sections/1/activities/Worksheet/gradebook'
 
114
 
 
115
Log in as a student and change to the spring section:
 
116
 
 
117
    >>> claudia = Browser('claudia', 'pwd')
 
118
    >>> claudia.getLink('Gradebook').click()
 
119
    >>> url = claudia.url
 
120
    >>> claudia.url
 
121
    'http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/mygrades'
 
122
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[1]/td')
 
123
    <td colspan="2" class="odd student_cell">
 
124
      <div> Ave.: 49.3%</div>
 
125
    </td>
 
126
 
 
127
    >>> claudia.open(url+'?currentTerm=2005-2006-.spring-')
 
128
    >>> claudia.url
 
129
    'http://localhost/schoolyears/2005-2006/spring/sections/1/activities/Worksheet/mygrades'
 
130
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[1]/td')
 
131
    <td colspan="2" class="odd student_cell">
 
132
      <div> Ave.: 82.0%</div>
 
133
    </td>
 
134
    >>> claudia.getLink('Gradebook').click()
 
135
    >>> claudia.url
 
136
    'http://localhost/schoolyears/2005-2006/spring/sections/1/activities/Worksheet/mygrades'
 
137
 
 
138
We need to make sure that we can handle the case where the last visited section
 
139
was since deleted.  First we'll delete the spring section of Physics.
 
140
 
 
141
    >>> manager.getLink('2005-2006').click()
 
142
    >>> manager.getLink('Spring').click()
 
143
    >>> manager.getLink('Sections').click()
 
144
    >>> manager.getControl(name='delete.1').value = True
 
145
    >>> manager.getControl('Delete').click()
 
146
    >>> manager.getControl('Confirm').click()
 
147
 
 
148
Now when Stephan or Claudia hit the Gradebook tab, they get redirected to the
 
149
fall term for the Physics section since the spring section is gone.
 
150
 
 
151
    >>> stephan.getLink('Gradebook').click()
 
152
    >>> stephan.url
 
153
    'http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/gradebook'
 
154
 
 
155
    >>> claudia.getLink('Gradebook').click()
 
156
    >>> claudia.url
 
157
    'http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/mygrades'