1
Test for section instructor/student propagation to linked sections
2
==================================================================
6
>>> manager = browsers.manager
7
>>> manager.ui.login('manager', 'schooltool')
11
>>> manager.open('http://localhost/time?value=2014-01-01')
13
Create a year with four terms:
15
>>> manager.ui.schoolyear.add('2014', '2014-01-01', '2014-12-31')
17
>>> manager.ui.term.add('2014', 'Q1', '2014-01-01', '2014-03-31')
18
>>> manager.ui.term.add('2014', 'Q2', '2014-04-01', '2014-06-30')
19
>>> manager.ui.term.add('2014', 'Q3', '2014-07-01', '2014-09-30')
20
>>> manager.ui.term.add('2014', 'Q4', '2014-10-01', '2014-12-31')
24
>>> manager.ui.person.add('Jeffrey', 'Elkner', 'jeffrey', 'schooltool')
25
>>> manager.ui.person.add('David', 'Welsh', 'david', 'schooltool')
26
>>> manager.ui.person.add('Camila', 'Cerna', 'camila', 'schooltool')
27
>>> manager.ui.person.add('Mario', 'Tejada', 'mario', 'schooltool')
29
Add a course with a multi-term section:
31
>>> manager.ui.course.add('2014', 'Math')
33
>>> manager.ui.section.add('2014', 'Q1', 'Math', ends='Q4')
35
Add instructors and students to the Q1 section:
37
>>> manager.ui.section.instructors.add(
38
... '2014', 'Q1', 'Math (1)', instructors=['jeffrey'])
39
>>> manager.ui.section.instructors.add(
40
... '2014', 'Q1', 'Math (1)', instructors=['david'],
41
... state='Substitute')
43
>>> manager.ui.section.students.add(
44
... '2014', 'Q1', 'Math (1)', students=['camila', 'mario'])
46
Visit the four linked sections and print their instructors and
49
>>> manager.ui.section.instructors.print_table('2014', 'Q1', 'Math (1)')
50
+-----------+------------+----------+------------+
51
| Last Name | First Name | Username | Status |
52
+-----------+------------+----------+------------+
53
| Elkner | Jeffrey | jeffrey | Instructor |
54
| Welsh | David | david | Substitute |
55
+-----------+------------+----------+------------+
56
>>> manager.ui.section.students.print_table('2014', 'Q1', 'Math (1)')
57
+-----------+------------+----------+----------+
58
| Last Name | First Name | Username | Status |
59
+-----------+------------+----------+----------+
60
| Cerna | Camila | camila | Enrolled |
61
| Tejada | Mario | mario | Enrolled |
62
+-----------+------------+----------+----------+
64
>>> manager.ui.section.instructors.print_table('2014', 'Q2', 'Math (1)')
65
+-----------+------------+----------+------------+
66
| Last Name | First Name | Username | Status |
67
+-----------+------------+----------+------------+
68
| Elkner | Jeffrey | jeffrey | Instructor |
69
| Welsh | David | david | Substitute |
70
+-----------+------------+----------+------------+
71
>>> manager.ui.section.students.print_table('2014', 'Q2', 'Math (1)')
72
+-----------+------------+----------+----------+
73
| Last Name | First Name | Username | Status |
74
+-----------+------------+----------+----------+
75
| Cerna | Camila | camila | Enrolled |
76
| Tejada | Mario | mario | Enrolled |
77
+-----------+------------+----------+----------+
79
>>> manager.ui.section.instructors.print_table('2014', 'Q3', 'Math (1)')
80
+-----------+------------+----------+------------+
81
| Last Name | First Name | Username | Status |
82
+-----------+------------+----------+------------+
83
| Elkner | Jeffrey | jeffrey | Instructor |
84
| Welsh | David | david | Substitute |
85
+-----------+------------+----------+------------+
86
>>> manager.ui.section.students.print_table('2014', 'Q3', 'Math (1)')
87
+-----------+------------+----------+----------+
88
| Last Name | First Name | Username | Status |
89
+-----------+------------+----------+----------+
90
| Cerna | Camila | camila | Enrolled |
91
| Tejada | Mario | mario | Enrolled |
92
+-----------+------------+----------+----------+
94
>>> manager.ui.section.instructors.print_table('2014', 'Q4', 'Math (1)')
95
+-----------+------------+----------+------------+
96
| Last Name | First Name | Username | Status |
97
+-----------+------------+----------+------------+
98
| Elkner | Jeffrey | jeffrey | Instructor |
99
| Welsh | David | david | Substitute |
100
+-----------+------------+----------+------------+
101
>>> manager.ui.section.students.print_table('2014', 'Q4', 'Math (1)')
102
+-----------+------------+----------+----------+
103
| Last Name | First Name | Username | Status |
104
+-----------+------------+----------+----------+
105
| Cerna | Camila | camila | Enrolled |
106
| Tejada | Mario | mario | Enrolled |
107
+-----------+------------+----------+----------+
109
Let's modify today's date:
111
>>> manager.open('http://localhost/time?value=2014-01-02')
113
Now, let's remove an instructor from the Q2 section and a student from
116
>>> manager.ui.section.instructors.remove(
117
... '2014', 'Q2', 'Math (1)', instructors=['david'])
119
>>> manager.ui.section.students.remove(
120
... '2014', 'Q3', 'Math (1)', students=['camila'])
122
Let's print all the tables again to see the changes propagated:
124
>>> manager.ui.section.instructors.print_table('2014', 'Q1', 'Math (1)')
125
+-----------+------------+----------+------------+
126
| Last Name | First Name | Username | Status |
127
+-----------+------------+----------+------------+
128
| Elkner | Jeffrey | jeffrey | Instructor |
129
| Welsh | David | david | Substitute |
130
+-----------+------------+----------+------------+
131
>>> manager.ui.section.students.print_table('2014', 'Q1', 'Math (1)')
132
+-----------+------------+----------+----------+
133
| Last Name | First Name | Username | Status |
134
+-----------+------------+----------+----------+
135
| Cerna | Camila | camila | Enrolled |
136
| Tejada | Mario | mario | Enrolled |
137
+-----------+------------+----------+----------+
139
>>> manager.ui.section.instructors.print_table('2014', 'Q2', 'Math (1)')
140
+-----------+------------+----------+------------+
141
| Last Name | First Name | Username | Status |
142
+-----------+------------+----------+------------+
143
| Elkner | Jeffrey | jeffrey | Instructor |
144
| Welsh | David | david | Withdrawn |
145
+-----------+------------+----------+------------+
146
>>> manager.ui.section.students.print_table('2014', 'Q2', 'Math (1)')
147
+-----------+------------+----------+----------+
148
| Last Name | First Name | Username | Status |
149
+-----------+------------+----------+----------+
150
| Cerna | Camila | camila | Enrolled |
151
| Tejada | Mario | mario | Enrolled |
152
+-----------+------------+----------+----------+
154
>>> manager.ui.section.instructors.print_table('2014', 'Q3', 'Math (1)')
155
+-----------+------------+----------+------------+
156
| Last Name | First Name | Username | Status |
157
+-----------+------------+----------+------------+
158
| Elkner | Jeffrey | jeffrey | Instructor |
159
| Welsh | David | david | Withdrawn |
160
+-----------+------------+----------+------------+
161
>>> manager.ui.section.students.print_table('2014', 'Q3', 'Math (1)')
162
+-----------+------------+----------+-----------+
163
| Last Name | First Name | Username | Status |
164
+-----------+------------+----------+-----------+
165
| Cerna | Camila | camila | Withdrawn |
166
| Tejada | Mario | mario | Enrolled |
167
+-----------+------------+----------+-----------+
169
>>> manager.ui.section.instructors.print_table('2014', 'Q4', 'Math (1)')
170
+-----------+------------+----------+------------+
171
| Last Name | First Name | Username | Status |
172
+-----------+------------+----------+------------+
173
| Elkner | Jeffrey | jeffrey | Instructor |
174
| Welsh | David | david | Withdrawn |
175
+-----------+------------+----------+------------+
176
>>> manager.ui.section.students.print_table('2014', 'Q4', 'Math (1)')
177
+-----------+------------+----------+-----------+
178
| Last Name | First Name | Username | Status |
179
+-----------+------------+----------+-----------+
180
| Cerna | Camila | camila | Withdrawn |
181
| Tejada | Mario | mario | Enrolled |
182
+-----------+------------+----------+-----------+
184
Now, let's add a new student to the Q1 section as Pending today but
185
who becomes Enrolled next week for section Q3:
187
>>> manager.ui.person.add('Nestor', 'Guzman', 'nestor', 'schooltool')
188
>>> manager.ui.section.students.add(
189
... '2014', 'Q1', 'Math (1)', students=['nestor'], state='Pending')
190
>>> manager.ui.section.students.remove(
191
... '2014', 'Q3', 'Math (1)', ['nestor'], 'Enrolled', '2014-01-07')
193
Let's print all the student tables again:
195
>>> manager.ui.section.students.print_table('2014', 'Q1', 'Math (1)')
196
+-----------+------------+----------+----------+
197
| Last Name | First Name | Username | Status |
198
+-----------+------------+----------+----------+
199
| Cerna | Camila | camila | Enrolled |
200
| Guzman | Nestor | nestor | Pending |
201
| Tejada | Mario | mario | Enrolled |
202
+-----------+------------+----------+----------+
204
>>> manager.ui.section.students.print_table('2014', 'Q2', 'Math (1)')
205
+-----------+------------+----------+----------+
206
| Last Name | First Name | Username | Status |
207
+-----------+------------+----------+----------+
208
| Cerna | Camila | camila | Enrolled |
209
| Guzman | Nestor | nestor | Pending |
210
| Tejada | Mario | mario | Enrolled |
211
+-----------+------------+----------+----------+
213
>>> manager.ui.section.students.print_table('2014', 'Q3', 'Math (1)')
214
+-----------+------------+----------+-----------+
215
| Last Name | First Name | Username | Status |
216
+-----------+------------+----------+-----------+
217
| Cerna | Camila | camila | Withdrawn |
218
| Guzman | Nestor | nestor | Pending |
219
| Tejada | Mario | mario | Enrolled |
220
+-----------+------------+----------+-----------+
222
>>> manager.ui.section.students.print_table('2014', 'Q4', 'Math (1)')
223
+-----------+------------+----------+-----------+
224
| Last Name | First Name | Username | Status |
225
+-----------+------------+----------+-----------+
226
| Cerna | Camila | camila | Withdrawn |
227
| Guzman | Nestor | nestor | Pending |
228
| Tejada | Mario | mario | Enrolled |
229
+-----------+------------+----------+-----------+
231
Let's change today's date again:
233
>>> manager.open('http://localhost/time?value=2014-01-07')
235
If we print the tables we'll see that Nestor became enrolled in the Q3
238
>>> manager.ui.section.students.print_table('2014', 'Q1', 'Math (1)')
239
+-----------+------------+----------+----------+
240
| Last Name | First Name | Username | Status |
241
+-----------+------------+----------+----------+
242
| Cerna | Camila | camila | Enrolled |
243
| Guzman | Nestor | nestor | Pending |
244
| Tejada | Mario | mario | Enrolled |
245
+-----------+------------+----------+----------+
247
>>> manager.ui.section.students.print_table('2014', 'Q2', 'Math (1)')
248
+-----------+------------+----------+----------+
249
| Last Name | First Name | Username | Status |
250
+-----------+------------+----------+----------+
251
| Cerna | Camila | camila | Enrolled |
252
| Guzman | Nestor | nestor | Pending |
253
| Tejada | Mario | mario | Enrolled |
254
+-----------+------------+----------+----------+
256
>>> manager.ui.section.students.print_table('2014', 'Q3', 'Math (1)')
257
+-----------+------------+----------+-----------+
258
| Last Name | First Name | Username | Status |
259
+-----------+------------+----------+-----------+
260
| Cerna | Camila | camila | Withdrawn |
261
| Guzman | Nestor | nestor | Enrolled |
262
| Tejada | Mario | mario | Enrolled |
263
+-----------+------------+----------+-----------+
265
>>> manager.ui.section.students.print_table('2014', 'Q4', 'Math (1)')
266
+-----------+------------+----------+-----------+
267
| Last Name | First Name | Username | Status |
268
+-----------+------------+----------+-----------+
269
| Cerna | Camila | camila | Withdrawn |
270
| Guzman | Nestor | nestor | Enrolled |
271
| Tejada | Mario | mario | Enrolled |
272
+-----------+------------+----------+-----------+