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

« back to all changes in this revision

Viewing changes to src/schooltool/gradebook/browser/ftests/sections_without_course.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
Sections without Courses
 
2
------------------------
 
3
 
 
4
A corner case to handle is the gradebook of sections that for some
 
5
reason are not related with a course. This can happen if the course is
 
6
created, then the section is created and related to the course and
 
7
then the course is deleted. Of course that's not a very smart way to
 
8
use SchoolTool, but some users have done it.
 
9
 
 
10
Log in as manager:
 
11
 
 
12
    >>> manager = Browser('manager', 'schooltool')
 
13
 
 
14
Now, set up a school year (2005-2006) with two terms (Fall and
 
15
Spring):
 
16
 
 
17
    >>> from schooltool.app.browser.ftests import setup
 
18
    >>> setup.setUpBasicSchool()
 
19
 
 
20
Set up two courses:
 
21
 
 
22
    >>> setup.addCourse('Physics I', '2005-2006')
 
23
    >>> setup.addCourse('Math I', '2005-2006')
 
24
 
 
25
Set up persons:
 
26
 
 
27
    >>> from schooltool.basicperson.browser.ftests.setup import addPerson
 
28
    >>> addPerson('Paul', 'Cardune', 'paul', 'pwd', browser=manager)
 
29
    >>> addPerson('Tom', 'Hoffman', 'tom', 'pwd', browser=manager)
 
30
    >>> addPerson('Claudia', 'Richter', 'claudia', 'pwd', browser=manager)
 
31
    >>> addPerson('Stephan', 'Richter', 'stephan', 'pwd', browser=manager)
 
32
 
 
33
Set up one section with instructor and students:
 
34
 
 
35
    >>> setup.addSection('Math I', '2005-2006', 'Fall',
 
36
    ...                  instructors=['Stephan'],
 
37
    ...                  members=['Tom', 'Claudia', 'Paul'])
 
38
    >>> setup.addSection('Physics I', '2005-2006', 'Spring',
 
39
    ...                  instructors=['Stephan'],
 
40
    ...                  members=['Tom', 'Claudia', 'Paul'])
 
41
 
 
42
Log in as teacher:
 
43
 
 
44
    >>> stephan = Browser('stephan', 'pwd')
 
45
 
 
46
Add a couple of activities to the default worksheet:
 
47
 
 
48
    >>> stephan.getLink('Gradebook').click()
 
49
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
50
    2005-2006 / Fall
 
51
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
52
    Math I - Math I (1)
 
53
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
54
    <td class="active_tab">
 
55
      <span style="font-weight: bold;">Sheet1</span>
 
56
    </td>
 
57
    >>> stephan.getLink('New Activity').click()
 
58
    >>> stephan.getControl('Title').value = 'HW 1'
 
59
    >>> stephan.getControl('Description').value = 'Homework 1'
 
60
    >>> stephan.getControl('Category').value = ['assignment']
 
61
    >>> stephan.getControl('Maximum').value = '50'
 
62
    >>> stephan.getControl('Add').click()
 
63
 
 
64
    >>> stephan.getLink('New Activity').click()
 
65
    >>> stephan.getControl('Title').value = 'Quiz'
 
66
    >>> stephan.getControl('Description').value = 'Week 1 Pop Quiz'
 
67
    >>> stephan.getControl('Category').value = ['exam']
 
68
    >>> stephan.getControl('Add').click()
 
69
 
 
70
Add some grades:
 
71
 
 
72
    >>> stephan.getControl(name='Activity_paul').value = '40'
 
73
    >>> stephan.getControl(name='Activity_tom').value = '48'
 
74
    >>> stephan.getControl(name='Activity_claudia').value = '45'
 
75
 
 
76
    >>> stephan.getControl(name='Activity-2_paul').value = '90'
 
77
    >>> stephan.getControl(name='Activity-2_tom').value = '88'
 
78
    >>> stephan.getControl(name='Activity-2_claudia').value = '29'
 
79
 
 
80
    >>> stephan.getControl('Save').click()
 
81
 
 
82
Let's delete the course of this section:
 
83
 
 
84
    >>> manager.getLink('Manage').click()
 
85
    >>> manager.getLink('School Years').click()
 
86
    >>> manager.getLink('2005-2006').click()
 
87
    >>> manager.getLink('Courses').click()
 
88
    >>> manager.getControl(name='delete.math-i').value = True
 
89
    >>> manager.getControl('Delete').click()
 
90
    >>> manager.getControl('Confirm').click()
 
91
 
 
92
Now, let's go to our orphan section:
 
93
 
 
94
    >>> manager.getLink('Manage').click()
 
95
    >>> manager.getLink('School Years').click()
 
96
    >>> manager.getLink('2005-2006').click()
 
97
    >>> manager.getLink('Fall').click()
 
98
    >>> manager.getLink('Sections').click()
 
99
    >>> manager.getLink('Math I (1)').click()
 
100
 
 
101
And we can access its gradebook:
 
102
 
 
103
    >>> manager.getLink('Gradebook', index=1).click()
 
104
    >>> manager.printQuery('//form/*[position()<3]/text()')
 
105
    Term:
 
106
    2005-2006 / Fall
 
107
    >>> manager.printQuery('//form/*[position()>3 and position()<6]/text()')
 
108
    Section:
 
109
    - Math I (1)
 
110
    >>> manager.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
111
    <td class="active_tab">
 
112
      <span style="font-weight: bold;">Sheet1</span>
 
113
    </td>
 
114
 
 
115
Now, let's check that the teacher can access the orphan gradebook:
 
116
 
 
117
    >>> stephan.getLink('Home').click()
 
118
    >>> stephan.getLink('Math I').click()
 
119
    >>> stephan.getLink('Gradebook', index=1).click()
 
120
    >>> stephan.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
121
    2005-2006 / Fall
 
122
    >>> stephan.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
123
    - Math I (1)
 
124
    >>> stephan.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
125
    <td class="active_tab">
 
126
      <span style="font-weight: bold;">Sheet1</span>
 
127
    </td>
 
128
 
 
129
And the 'view.html' view on the Student gradebook:
 
130
 
 
131
    >>> stephan.open('http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/gradebook/paul/view.html')
 
132
    >>> stephan.printQuery('id("content-header")/h1')
 
133
    <h1>Sheet1 for Paul Cardune in - Math I (1)</h1>
 
134
 
 
135
Now, let's check that a student can access the orphan gradebook:
 
136
 
 
137
    >>> claudia = Browser('claudia', 'pwd')
 
138
    >>> claudia.open('http://localhost/schoolyears/2005-2006/fall/sections/1/activities/Worksheet/mygrades?currentTerm=2005-2006-.fall-')
 
139
    >>> claudia.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
140
    2005-2006 / Fall
 
141
    >>> claudia.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
142
    - Math I (1)
 
143
    >>> claudia.printQuery('//table[@class="schooltool_gradebook"][1]/tr/td')
 
144
    <td class="active_tab">
 
145
      <span style="font-weight: bold;">Sheet1</span>
 
146
    </td>
 
147
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[1]/td')
 
148
    <td colspan="2" class="odd student_cell">
 
149
      <div> Ave.: 49.3%</div>
 
150
    </td>
 
151
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[1]/div/text()')
 
152
    Activity
 
153
    HW 1 - Homework 1
 
154
    Quiz - Week 1 Pop Quiz
 
155
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[2]/div/text()')
 
156
    Grade
 
157
    45 / 50
 
158
    29 / 100
 
159
 
 
160
And her other gradebooks:
 
161
 
 
162
    >>> claudia.getControl(name='currentTerm').value = ['2005-2006-.spring-']
 
163
    >>> claudia.getForm(index=0).submit()
 
164
    >>> claudia.printQuery('//select[@name="currentTerm"]/option[@selected="selected"]/text()')
 
165
    2005-2006 / Spring
 
166
    >>> claudia.printQuery('//select[@name="currentSection"]/option[@selected="selected"]/text()')
 
167
    Physics I - Physics I (1)
 
168
    >>> claudia.printQuery('//td[@class="active_tab"]')
 
169
    <td class="active_tab">
 
170
      <span style="font-weight: bold;">Sheet1</span>
 
171
    </td>
 
172
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[1]/td')
 
173
    <td colspan="2" class="odd student_cell">
 
174
      <div>Nothing Graded</div>
 
175
    </td>
 
176
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[1]/div/text()')
 
177
    Activity
 
178
    >>> claudia.printQuery('//table[@class="student_gradebook"]/tr[position()>1]/*[2]/div/text()')
 
179
    Grade