5
These are the functional tests for the intervention package.
7
First we need to set up the school.
9
>>> from schooltool.intervention.browser import ftests
10
>>> from schooltool.app.browser.ftests import setup
11
>>> setup.setUpBasicSchool()
12
>>> manager = setup.logIn('manager', 'schooltool')
18
Now we come to the main intervention center that gives us access to all of the
19
intervention data associated with a given student for a given school year.
20
We'll create some teachers and students and put them in some sections.
21
We will also create a principal and guidance counselor and put them in the
22
adminstators group. These users will show up as part of the list of persons
23
responsible for any student and will also have permission to work with the
24
intervention of any student.
26
>>> from schooltool.intervention.browser.ftests import (
27
... addPerson, addCourseSectionMembers, fillInContactInfo)
29
>>> manager.getLink('Home').click()
30
>>> fillInContactInfo('manager', email='manager@example.com')
32
>>> addPerson('Teacher1', 'Teacher1', 'teacher1', 'pwd', groups=['teachers'])
33
>>> addPerson('Teacher2', 'Teacher2', 'teacher2', 'pwd', groups=['teachers'])
34
>>> addPerson('Student1', 'Student1', 'student1', 'pwd', groups=['students'])
35
>>> addPerson('Student2', 'Student2', 'student2', 'pwd', groups=['students'])
36
>>> addPerson('Student3', 'Student3', 'student3', 'pwd', groups=['students'])
37
>>> addCourseSectionMembers('course1', 'section1', ['Teacher1'],
38
... ['Student1', 'Student3'])
39
>>> addCourseSectionMembers('course2', 'section2', ['Teacher2'],
41
>>> addPerson('Counselor', 'Counselor', 'counselor', 'pwd', groups=['administrators'])
42
>>> addPerson('Principal', 'Principal', 'principal', 'pwd', groups=['administrators'])
43
>>> addPerson('Search Person', 'Person Search', 'sperson', 'pwd')
45
Let's add a parent contact and an advisor which will show up when adding goals
48
>>> manager.getLink('Manage').click()
49
>>> manager.getLink('Persons').click()
50
>>> manager.getLink('Student1').click()
51
>>> manager.getLink('Contacts').click()
52
>>> manager.getLink('Manage Contacts').click()
53
>>> manager.getLink('Create new contact').click()
54
>>> manager.getControl('First name').value = 'Parent1'
55
>>> manager.getControl('Last name').value = 'Parent1'
56
>>> manager.getControl('Email').value = 'parent@somewhere.com'
57
>>> manager.getControl('Relationship').value = ['parent']
58
>>> manager.getControl('Add').click()
60
>>> manager.getLink('Advisors').click()
61
>>> manager.getControl(name='add_item.teacher2').value = 'checked'
62
>>> manager.getControl('Add').click()
64
To navigate to a student's intervention, a manager can navigate to the student
65
and click on the 'Intervention Center' action link.
67
>>> manager.getLink('Manage').click()
68
>>> manager.getLink('Persons').click()
69
>>> manager.getLink('Student1').click()
70
>>> manager.getLink('Intervention Center').click()
71
>>> print manager.contents
73
...Student Intervention Center...
74
...Student1 Student1...
75
...Messages and Observations...
78
...Goals and Interventions...
81
...Change of Status Messages...
83
...New Status Message...
89
The first thing we'll add is a new message. Calling up the add view, we'll
90
note that the list of possible recipients will include, in order, the student's
91
advisors, the school administrators, the student's teachers, the student,
92
and the student's parents. Advisors and parents will have all caps prefixes
93
before their names to make it easier for the user to pick them out. Also,
94
the advisors will be pre-checked.
96
>>> manager.getLink('New Message').click()
97
>>> print manager.contents
100
...checked="checked"...
101
...Teacher2 Teacher2 (advisor)...
106
...Parent1 Parent1 (parent)...
108
We'll test how the add view handles missing input. We'll need to uncheck the
109
advisor to make the recipients input cause the error.
111
>>> manager.getControl(name='person.teacher2').value = False
112
>>> manager.getControl(name='UPDATE_SUBMIT').click()
113
>>> print manager.contents
115
...There are <strong>2</strong> input errors...
116
...Required data was not supplied...
117
...Required input is missing...
119
We'll fill in the required fields and hit the Add button. Note that upon
120
successfully adding the message, an email will appear in the output. This
121
is the result of the dummy mail sender that we use during testing that prints
122
emails that would otherwise be sent to the smtp mail server that a live
123
environment would have configured. Also note that the parent's email address
124
will be picked up from the student's demos.
126
>>> manager.getControl(name='person.teacher1').value = True
127
>>> manager.getControl(name='person.student1:1').value = True
128
>>> manager.getControl(name='field.body').value = 'hi\nthere'
129
>>> manager.getControl(name='UPDATE_SUBMIT').click()
130
From: manager@example.com
131
To: parent@somewhere.com, teacher1@example.com
132
Subject: INTERVENTION MESSAGE: Student1 Student1
133
SchoolTool Administrator writes:
138
Note that the successfully added message appears in the Intervention Center
139
with the username of the sender, in this case, manager.
141
>>> print manager.contents
143
...Messages and Observations...
144
...Message from SchoolTool Administrator...
147
Let's make sure we can view the message that we just added. Note that the
148
message body will be broken into <p> tags, one for each line.
150
>>> manager.getLink('Message from SchoolTool Administrator').click()
151
>>> analyze.printQuery("id('content-body')//div//span", manager.contents)
152
<span>Parent1 Parent1, Teacher1 Teacher1</span>
153
>>> analyze.printQuery("id('content-body')//p", manager.contents)
157
We should be able to return to the Intervention Center with a link.
159
>>> manager.getLink('Intervention Center').click()
160
>>> print manager.contents
162
...Messages and Observations...
163
...Message from SchoolTool Administrator...
166
We'll add a second message to test the system's handling of multiple
167
messages. Messages are sorted by date.
169
>>> manager.getLink('New Message').click()
170
>>> manager.getControl(name='person.teacher1').value = True
171
>>> manager.getControl(name='field.body').value = 'hello again'
172
>>> manager.getControl(name='UPDATE_SUBMIT').click()
173
From: manager@example.com
174
To: teacher1@example.com, teacher2@example.com
175
Subject: INTERVENTION MESSAGE: Student1 Student1
176
SchoolTool Administrator writes:
179
>>> print manager.contents
181
...Messages and Observations...
182
...student1/messages/2...Message from SchoolTool Administrator...
183
...student1/messages/1...Message from SchoolTool Administrator...
186
There is a button that allows us to call up the report that presents all of
187
the messages together. The messages are sorted by creation date.
189
>>> manager.getLink('View All Messages').click()
190
>>> analyze.printQuery("id('content-body')//span", manager.contents)
191
<span>Message sent by SchoolTool Administrator on ...</span>
192
<span>Teacher1 Teacher1, Teacher2 Teacher2</span>
193
<span>Message sent by SchoolTool Administrator on ...</span>
194
<span>Parent1 Parent1, Teacher1 Teacher1</span>
195
>>> analyze.printQuery("id('content-body')//p", manager.contents)
200
We'll return the the Intervention Center.
202
>>> manager.getLink('Intervention Center').click()
203
>>> print manager.contents
205
...Messages and Observations...
206
...Message from SchoolTool Administrator...
207
...Message from SchoolTool Administrator...
214
The next thing to start adding is Goals. We'll test how the add view
215
handles missing input while we're at it. To make the persons responsible
216
field have missing data, we'll need to uncheck the advisor that comes
219
>>> from datetime import date
220
>>> manager.getLink('New Goal').click()
221
>>> manager.getControl(name='person.teacher2').value = False
222
>>> manager.getControl(name='UPDATE_SUBMIT').click()
223
>>> print manager.contents
225
...There are <strong>7</strong> input errors...
226
...Persons responsible...
227
...Required data was not supplied...
228
...Presenting concerns...
229
...Required input is missing...
231
...Required input is missing...
233
...Required input is missing...
235
...Required input is missing...
237
...Required input is missing...
239
...Required input is missing...
240
...checked="checked"...
244
Now we'll fill in the required fields. We'll include the student and the
245
parent in the persons responsible list to demostrate how adding the goal
246
will split the email by staff and students/parents. Students and parents
247
will not get a link back to the intervention center in their email.
249
>>> manager.getControl('Presenting concerns').value = 'Poor attendence'
250
>>> manager.getControl(name='field.goal').value = 'Get student to come in more often'
251
>>> manager.getControl('Strengths').value = 'Attentive when there'
252
>>> manager.getControl('Indicators').value = 'Student appears at least 4 time a week'
253
>>> manager.getControl('Intervention').value = 'Call parents to arrange better attendence'
254
>>> manager.getControl('Timeline').value = str(date.today())
255
>>> manager.getControl(name='person.teacher1').value = True
256
>>> manager.getControl(name='person.student1').value = True
257
>>> manager.getControl(name='person.student1:1').value = True
258
>>> manager.getControl(name='goal_met').value = ['Yes']
259
>>> manager.getControl(name='UPDATE_SUBMIT').click()
260
From: manager@example.com
261
To: teacher1@example.com
262
Subject: INTERVENTION GOAL ADDED: Student1 Student1
263
The following goal was added for Student1 Student1:
273
Get student to come in more often
283
Student appears at least 4 time a week
288
Call parents to arrange better attendence
305
http://localhost/schooltool.interventions/2005-2006/student1
307
From: manager@example.com
308
To: parent@somewhere.com, student1@example.com
309
Subject: INTERVENTION GOAL ADDED: Student1 Student1
310
The following goal was added for Student1 Student1:
320
Get student to come in more often
330
Student appears at least 4 time a week
335
Call parents to arrange better attendence
349
Note that the successfully added goal appears in the Intervention Center as
352
>>> print manager.contents
354
...Goals and Interventions...
358
Let's make sure we can view the message that we just added.
360
>>> manager.getLink('Goal 1').click()
361
>>> print manager.contents
363
...Persons responsible...
364
...Parent1 Parent1...
365
...Student1 Student1...
366
...Teacher1 Teacher1...
367
...Presenting concerns...
368
...Poor attendence...
370
...Get student to come in more often...
372
...Attentive when there...
374
...Student appears at least 4 time a week...
376
...Call parents to arrange better attendence...
380
...Follow up notes...
382
Now that we've added a goal, let's edit it's strengths attribute and see that
383
the change is reflected in the goal's view.
385
>>> manager.getLink('Edit').click()
386
>>> print manager.contents
389
...checked="checked"...
391
>>> manager.getControl('Strengths').value = 'Good listener'
392
>>> manager.getControl(name='UPDATE_SUBMIT').click()
393
>>> print manager.contents
399
We should be able to return to the Intervention Center with a link.
401
>>> manager.getLink('Intervention Center').click()
402
>>> print manager.contents
404
...Goals and Interventions...
408
Let's add a second goal to test our handling of multiple goals both in the
409
notification view and the goals report.
411
>>> manager.getLink('New Goal').click()
412
>>> manager.getControl('Presenting concerns').value = 'Rude behavior'
413
>>> manager.getControl(name='field.goal').value = 'Get student to be more polite'
414
>>> manager.getControl('Strengths').value = 'Good grades'
415
>>> manager.getControl('Indicators').value = 'Student no longer offends classmates'
416
>>> manager.getControl('Intervention').value = 'Call parents to alert them to bad manners'
417
>>> manager.getControl('Timeline').value = str(date.today())
418
>>> manager.getControl(name='person.teacher2').value = False
419
>>> manager.getControl(name='person.teacher1').value = True
420
>>> manager.getControl(name='UPDATE_SUBMIT').click()
421
From: manager@example.com
422
To: teacher1@example.com
423
Subject: INTERVENTION GOAL ADDED: Student1 Student1
424
The following goal was added for Student1 Student1:
434
Get student to be more polite
444
Student no longer offends classmates
449
Call parents to alert them to bad manners
464
http://localhost/schooltool.interventions/2005-2006/student1
465
>>> print manager.contents
467
...Goals and Interventions...
472
There is a button that allows us to call up the report that presents all of
473
the goals together. Its output is a concatonation of what the view of goal 1
474
and the view of goal 2 would present.
476
>>> manager.getLink('View All Goals').click()
477
>>> print manager.contents
479
...Presenting concerns...
480
...Poor attendence...
482
...Get student to come in more often...
486
...Student appears at least 4 time a week...
488
...Call parents to arrange better attendence...
490
...Persons responsible...
491
...Parent1 Parent1...
492
...Student1 Student1...
493
...Teacher1 Teacher1...
496
...Follow up notes...
497
...Presenting concerns...
500
...Get student to be more polite...
504
...Student no longer offends classmates...
506
...Call parents to alert them to bad manners...
508
...Persons responsible...
509
...Teacher1 Teacher1...
512
...Follow up notes...
514
We have a view that can be called up at any time that will send emails for
515
goals that have come due today (we set up our goals to be due today). This
516
view will best be called automatically from a cron job making it a completely
517
automated system. Note that student and parent entered in the first goal will
518
not receive this email.
520
>>> manager.open('http://localhost/schooltool.interventions/notifyGoals.html')
521
From: manager@example.com
522
To: teacher1@example.com
523
Subject: INTERVENTION GOAL DUE: Student1 Student1
524
Please follow the link below to update the follow up notes and, if
525
appropriate, the goal met status of the intervention goal for Student1 Student1.
527
http://localhost/schooltool.interventions/2005-2006/student1/goals/1/@@editGoal.html
528
From: manager@example.com
529
To: teacher1@example.com
530
Subject: INTERVENTION GOAL DUE: Student1 Student1
531
Please follow the link below to update the follow up notes and, if
532
appropriate, the goal met status of the intervention goal for Student1 Student1.
534
http://localhost/schooltool.interventions/2005-2006/student1/goals/2/@@editGoal.html
536
>>> print manager.contents
538
...The following goals had notifications sent to the persons responsible:...
539
...Student1 Student1 goal 1...
540
...Student1 Student1 goal 2...
542
Now that the goals have been marked as notified, calling up the view again will
545
>>> manager.open('http://localhost/schooltool.interventions/notifyGoals.html')
546
>>> print manager.contents
548
...There are no goals that need notification...
551
Change of Status Messages
552
-------------------------
554
There is a need for special change of status messages that would rarely be
555
sent and should be organized at the bottom part of the Intervention Center.
556
The most extreme example of changing a student's status would be to expel
557
the student from school. Messages of that nature and less extreme can be
558
added using the separate 'Change of Status Messages' section of the student's
561
>>> manager.getLink('Manage').click()
562
>>> manager.getLink('Persons').click()
563
>>> manager.getLink('Student1').click()
564
>>> manager.getLink('Intervention Center').click()
566
>>> manager.getLink('New Status Message').click()
567
>>> manager.getControl(name='person.teacher2').value = False
568
>>> manager.getControl(name='person.teacher1').value = True
569
>>> manager.getControl(name='field.body').value = 'hello'
570
>>> manager.getControl(name='UPDATE_SUBMIT').click()
571
From: manager@example.com
572
To: teacher1@example.com
573
Subject: INTERVENTION STATUS CHANGE: Student1 Student1
574
SchoolTool Administrator writes:
577
>>> print manager.contents
579
...Messages and Observations...
580
...Message from SchoolTool Administrator...
581
...Message from SchoolTool Administrator...
583
...Change of Status Messages...
584
...Change of Status Message from SchoolTool Administrator...
585
...New Status Message...
587
Let's make sure we can view the message that we just added.
589
>>> manager.getLink('Change of Status Message from SchoolTool Administrator').click()
590
>>> print manager.contents
592
...Change of Status Message from: SchoolTool Administrator...
594
...Teacher1 Teacher1...
597
There is a view for viewing all change of status messages together as there
598
is with normal messages.
600
>>> manager.getLink('Intervention Center').click()
601
>>> manager.getLink('View All Status Messages').click()
602
>>> print manager.contents
604
...Change of Status Messages regarding Student1 Student1...
605
...Message sent by SchoolTool Administrator...
607
...Teacher1 Teacher1...
611
Section intervention view
612
-------------------------
614
The section intervention view gives quick access to various
615
intervention views for students in the section.
617
>>> manager.getLink('Manage').click()
618
>>> manager.getLink('School Years').click()
619
>>> manager.getLink('2005-2006').click()
620
>>> manager.getLink('Spring').click()
621
>>> manager.getLink('Sections').click()
622
>>> manager.getLink('section1').click()
623
>>> manager.getLink('Interventions').click()
625
The Messages tab is the default. The provided links allow the teacher to
626
preview existing and compose new messages. Note that status messages are
627
ignored when displaying message count for the student.
629
>>> print manager.contents
631
...course1 - section1's Student Interventions...
634
...Student1 Student1...
635
...View Messages (2)...
637
...Student3 Student3...
638
...View Messages (0)...
641
We can add a new message from here by clicking on the 'Write New' link. We'll
642
do this for Student3 to help set up dashboard tests.
644
>>> manager.getLink('Write New', index=1).click()
645
>>> manager.getControl(name='person.teacher1').value = True
646
>>> manager.getControl(name='field.body').value = 'Message for Student3'
647
>>> manager.getControl(name='UPDATE_SUBMIT').click()
648
From: manager@example.com
649
To: teacher1@example.com
650
Subject: INTERVENTION MESSAGE: Student3 Student3
651
SchoolTool Administrator writes:
655
The Goals tab provides shortcuts to viewing student goals.
657
>>> manager.getLink('Goals').click()
658
>>> print manager.contents
660
...course1 - section1's Student Interventions...
661
<a ...Messages</a> ...
663
...Student1 Student1...
665
...Student3 Student3...
669
Intervention Dashboard
670
----------------------
672
We provide an Intervention tab that takes the user to a kind of dashboard with
673
two fieldsets. The first serves as a launch point for the search student
674
intervention view where the user can find a student to which they have access.
675
The second fieldset functions similar to an email inbox, listing all messages
676
and goals that the user is responsible for, most recently created first.
678
We'll test the Inbox first as it resides on the Intervention tab view itself.
680
>>> teacher1 = setup.logIn('teacher1', 'pwd')
681
>>> ftests.addAdvisors('Student2', ['teacher1'])
683
>>> teacher1.getLink('Intervention').click()
684
>>> analyze.printQuery("id('content-body')/div/form/fieldset[2]/div/table/tbody//a", teacher1.contents)
685
<a href="http://localhost/persons/student3/schoolyears/2005-2006/messages/1">Message for Student3</a>
686
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/3">hello</a>
687
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/2">Rude behavior</a>
688
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/1">Poor attendence</a>
689
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/2">hello again</a>
690
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/1">hi there</a>
692
There is a name filter that can limit the list to students whose name contains
695
>>> teacher1.getControl(name='SEARCH_NAME').value = 'student3'
696
>>> teacher1.getControl(name='SEARCH_BUTTON').click()
697
>>> analyze.printQuery("id('content-body')/div/form/fieldset[2]/div/table/tbody//a", teacher1.contents)
698
<a href="http://localhost/persons/student3/schoolyears/2005-2006/messages/1">Message for Student3</a>
700
Hitting the 'Clear' button clears the filter and returns the original list.
702
>>> teacher1.getControl(name='CLEAR_SEARCH').click()
703
>>> analyze.printQuery("id('content-body')/div/form/fieldset[2]/div/table/tbody//a", teacher1.contents)
704
<a href="http://localhost/persons/student3/schoolyears/2005-2006/messages/1">Message for Student3</a>
705
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/3">hello</a>
706
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/2">Rude behavior</a>
707
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/1">Poor attendence</a>
708
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/2">hello again</a>
709
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/1">hi there</a>
711
There is also a goals only checkbox to filter the list to only student with
712
goals or only the goals in your inbox.
714
>>> teacher1.getControl(name='GOALS_ONLY').value = 'checked'
715
>>> teacher1.getControl(name='SEARCH_BUTTON').click()
716
>>> analyze.printQuery("id('content-body')/div/form/fieldset[2]/div/table/tbody//a", teacher1.contents)
717
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/2">Rude behavior</a>
718
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/1">Poor attendence</a>
720
Again, hitting the 'Clear' button clears the filter and returns the original list.
722
>>> teacher1.getControl(name='CLEAR_SEARCH').click()
723
>>> analyze.printQuery("id('content-body')/div/form/fieldset[2]/div/table/tbody//a", teacher1.contents)
724
<a href="http://localhost/persons/student3/schoolyears/2005-2006/messages/1">Message for Student3</a>
725
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/3">hello</a>
726
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/2">Rude behavior</a>
727
<a href="http://localhost/persons/student1/schoolyears/2005-2006/goals/1">Poor attendence</a>
728
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/2">hello again</a>
729
<a href="http://localhost/persons/student1/schoolyears/2005-2006/messages/1">hi there</a>
731
Now we'll test the lauch point that is the first fieldset. We'll just hit the
732
search student button to see that it takes us to the search student view. It
733
lists all the students that the user is responsible for as there was no filter
736
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
737
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
738
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
739
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
740
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
741
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
742
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
743
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
745
We'll apply the student name filter.
747
>>> teacher1.getControl(name='SEARCH_STUDENT_NAME').value = 'student3'
748
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
749
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
750
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
751
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
753
We'll clear the student filter and set the goals only filter.
755
>>> teacher1.getControl(name='CLEAR_STUDENT_SEARCH').click()
756
>>> teacher1.getControl(name='WITH_GOALS_ONLY').value = 'checked'
757
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
758
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
759
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
760
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
762
Finally clearing the filter restores the list to the original.
764
>>> teacher1.getControl(name='CLEAR_STUDENT_SEARCH').click()
765
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
766
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
767
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
768
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
769
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
770
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
771
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
773
A final test for the launch point is to show that the filter the user chooses
774
there gets immediately applied to the search student view, saving the user
777
>>> teacher1.getLink('Intervention').click()
778
>>> teacher1.getControl(name='SEARCH_STUDENT_NAME').value = 'student3'
779
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
780
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
781
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
782
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
784
>>> teacher1.getLink('Intervention').click()
785
>>> teacher1.getControl(name='WITH_GOALS_ONLY').value = 'checked'
786
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
787
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", teacher1.contents)
788
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
789
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
791
If we are to present the user with intervention student links, we have to be
792
sure that when they vist one of them, it doesn't say Not Found. That can be
793
prevented by auto-vivifying the intervention student object before we present
794
it as a link. We'll test that each student that we present as a link can be
797
>>> teacher1.getLink('Intervention').click()
798
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
799
>>> teacher1.getLink('Student1').click()
801
'http://localhost/schooltool.interventions/2005-2006/student1'
803
>>> teacher1.getLink('Intervention').click()
804
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
805
>>> teacher1.getLink('Student2').click()
807
'http://localhost/schooltool.interventions/2005-2006/student2'
809
>>> teacher1.getLink('Intervention').click()
810
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
811
>>> teacher1.getLink('Student3').click()
813
'http://localhost/schooltool.interventions/2005-2006/student3'
815
We will provide a button for the user to return from the search student view
816
back to the inbox in case it is not obvious to use the Intervention tab.
818
>>> teacher1.getLink('Intervention').click()
819
>>> teacher1.getControl(name='SEARCH_STUDENT_BUTTON').click()
820
>>> teacher1.getLink('Return to Inbox').click()
822
'http://localhost/persons/teacher1/intervention_tab'
824
Users that are in the admin group will see all persons when they search.
826
>>> manager.getLink('Intervention').click()
827
>>> manager.getControl(name='SEARCH_STUDENT_BUTTON').click()
828
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", manager.contents)
829
<a href="http://localhost/schooltool.interventions/2005-2006/manager">SchoolTool</a>
830
<a href="http://localhost/schooltool.interventions/2005-2006/manager">Administrator</a>
831
<a href="http://localhost/schooltool.interventions/2005-2006/counselor">Counselor</a>
832
<a href="http://localhost/schooltool.interventions/2005-2006/counselor">Counselor</a>
833
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Search Person</a>
834
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Person Search</a>
835
<a href="http://localhost/schooltool.interventions/2005-2006/principal">Principal</a>
836
<a href="http://localhost/schooltool.interventions/2005-2006/principal">Principal</a>
837
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
838
<a href="http://localhost/schooltool.interventions/2005-2006/student1">Student1</a>
839
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
840
<a href="http://localhost/schooltool.interventions/2005-2006/student2">Student2</a>
841
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
842
<a href="http://localhost/schooltool.interventions/2005-2006/student3">Student3</a>
843
<a href="http://localhost/schooltool.interventions/2005-2006/teacher1">Teacher1</a>
844
<a href="http://localhost/schooltool.interventions/2005-2006/teacher1">Teacher1</a>
845
<a href="http://localhost/schooltool.interventions/2005-2006/teacher2">Teacher2</a>
846
<a href="http://localhost/schooltool.interventions/2005-2006/teacher2">Teacher2</a>
848
We will show here how usernames can be searched as well. The only person who's
849
name is different than the userid is 'sperson', so we'll prove this point using
852
>>> manager.getControl(name='SEARCH_STUDENT_NAME').value = 'sperson'
853
>>> manager.getControl(name='SEARCH_STUDENT_BUTTON').click()
854
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", manager.contents)
855
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Search Person</a>
856
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Person Search</a>
858
>>> manager.getControl(name='SEARCH_STUDENT_NAME').value = 's person'
859
>>> manager.getControl(name='SEARCH_STUDENT_BUTTON').click()
860
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", manager.contents)
862
>>> manager.getControl(name='SEARCH_STUDENT_NAME').value = 'search person'
863
>>> manager.getControl(name='SEARCH_STUDENT_BUTTON').click()
864
>>> analyze.printQuery("id('content-body')/div/form/fieldset[1]/div/table/tbody//a", manager.contents)
865
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Search Person</a>
866
<a href="http://localhost/schooltool.interventions/2005-2006/sperson">Person Search</a>
869
At One Time Responsible
870
-----------------------
872
We have a special case in the user interface for editing goals where one of
873
the persons_responsible is no longer either a teacher, advisor or administrator
874
of the student. The security issues regarding this scenario are tested in
875
security.txt, but here we need to test the way it is handled in the UI.
877
First of all, we already have created a goal where teacher1 is responsible.
878
When we call up the edit view for the goal, we note that teacher1 appears
879
in the staff section of the person list, not the student section. We also
880
note that he is checked.
882
>>> manager.open('http://localhost/schooltool.interventions/2005-2006/student1/goals/2/editGoal.html')
883
>>> analyze.printQuery('//table//tr[2]//td[1]//span', manager.contents)
885
<b>Teacher2 Teacher2 (advisor)</b>
888
<b>Counselor Counselor</b>
891
<b>Principal Principal</b>
894
<b>Teacher1 Teacher1</b>
896
>>> analyze.printQuery('//table//tr[2]//td[1]//input[@type="checkbox"]', manager.contents)
897
<input type="checkbox" class="person_list" name="person.teacher2" />
898
<input type="checkbox" class="person_list" name="person.counselor" />
899
<input type="checkbox" class="person_list" name="person.principal" />
900
<input type="checkbox" class="person_list" checked="checked" name="person.teacher1" />
901
>>> analyze.printQuery('//table//tr[2]//td[2]//span', manager.contents)
903
<b>Student1 Student1</b>
906
<b>Parent1 Parent1 (parent)</b>
908
>>> analyze.printQuery('//table//tr[2]//td[2]//input[@type="checkbox"]', manager.contents)
909
<input type="checkbox" name="person.student1" />
910
<input type="checkbox" name="person.student1:1" />
912
We want to remove him from the section that gave him access to the student.
914
>>> manager.getLink('2005-2006').click()
915
>>> manager.getLink('Spring').click()
916
>>> manager.getLink('Sections').click()
917
>>> manager.getLink('section1').click()
918
>>> manager.getLink('edit instructors').click()
919
>>> manager.getControl(name='remove_item.teacher1').value = 'checked'
920
>>> manager.getControl('Remove').click()
922
Now, let's edit the goal and note that there is a new section in the person
923
list labeled 'Changed Status' and that teacher1 is listed there and is still
926
>>> manager.open('http://localhost/schooltool.interventions/2005-2006/student1/goals/2/editGoal.html')
927
>>> analyze.printQuery('//table//tr[2]//td[1]//span', manager.contents)
929
<b>Teacher2 Teacher2 (advisor)</b>
932
<b>Counselor Counselor</b>
935
<b>Principal Principal</b>
937
>>> analyze.printQuery('//table//tr[2]//td[1]//input[@type="checkbox"]', manager.contents)
938
<input type="checkbox" class="person_list" name="person.teacher2" />
939
<input type="checkbox" class="person_list" name="person.counselor" />
940
<input type="checkbox" class="person_list" name="person.principal" />
941
>>> analyze.printQuery('//table//tr[2]//td[2]//span', manager.contents)
943
<b>Student1 Student1</b>
946
<b>Parent1 Parent1 (parent)</b>
948
<span>Changed Status</span>
950
<b>Teacher1 Teacher1</b>
952
>>> analyze.printQuery('//table//tr[2]//td[2]//input[@type="checkbox"]', manager.contents)
953
<input type="checkbox" name="person.student1" />
954
<input type="checkbox" name="person.student1:1" />
955
<input type="checkbox" checked="checked" name="person.teacher1" />
957
We'll go ahead and uncheck him, or course, checking another person in order
958
to successfully submit.
960
>>> manager.getControl(name='person.teacher1').value = False
961
>>> manager.getControl(name='person.teacher2').value = True
962
>>> manager.getControl('Apply').click()
964
Now we see that the teacher is still in the 'Changed Status' section but not
965
checked. This represents the scenario where the teacher no longer can
966
add goals for the student, nor can he even view this goal anymore. However,
967
we keep him around in the goal.at_one_time_responsible list, and thus, he
968
will continue to appear in the person list in the special section. Maybe we'll
969
want to put him back in the persons_responsible list at a later date.
971
>>> manager.open('http://localhost/schooltool.interventions/2005-2006/student1/goals/2/editGoal.html')
972
>>> analyze.printQuery('//table//tr[2]//td[1]//span', manager.contents)
974
<b>Teacher2 Teacher2 (advisor)</b>
977
<b>Counselor Counselor</b>
980
<b>Principal Principal</b>
982
>>> analyze.printQuery('//table//tr[2]//td[1]//input[@type="checkbox"]', manager.contents)
983
<input type="checkbox" class="person_list" checked="checked" name="person.teacher2" />
984
<input type="checkbox" class="person_list" name="person.counselor" />
985
<input type="checkbox" class="person_list" name="person.principal" />
986
>>> analyze.printQuery('//table//tr[2]//td[2]//span', manager.contents)
988
<b>Student1 Student1</b>
991
<b>Parent1 Parent1 (parent)</b>
993
<span>Changed Status</span>
995
<b>Teacher1 Teacher1</b>
997
>>> analyze.printQuery('//table//tr[2]//td[2]//input[@type="checkbox"]', manager.contents)
998
<input type="checkbox" name="person.student1" />
999
<input type="checkbox" name="person.student1:1" />
1000
<input type="checkbox" name="person.teacher1" />
1002
Finally, we'd like to make sure that when we make teacher1 again the teacher
1003
of one of student1's sections, he will appear back in the original section
1006
>>> manager.getLink('2005-2006').click()
1007
>>> manager.getLink('Spring').click()
1008
>>> manager.getLink('Sections').click()
1009
>>> manager.getLink('section1').click()
1010
>>> manager.getLink('edit instructors').click()
1011
>>> manager.getControl(name='add_item.teacher1').value = 'checked'
1012
>>> manager.getControl('Add').click()
1014
So now when we go back to edit the goal, teacher1 appears back in the original
1015
section, unchecked. Also, the 'Changed Status' section disappears. It's like
1018
>>> manager.open('http://localhost/schooltool.interventions/2005-2006/student1/goals/2/editGoal.html')
1019
>>> analyze.printQuery('//table//tr[2]//td[1]//span', manager.contents)
1021
<b>Teacher2 Teacher2 (advisor)</b>
1024
<b>Counselor Counselor</b>
1027
<b>Principal Principal</b>
1030
<b>Teacher1 Teacher1</b>
1032
>>> analyze.printQuery('//table//tr[2]//td[1]//input[@type="checkbox"]', manager.contents)
1033
<input type="checkbox" class="person_list" checked="checked" name="person.teacher2" />
1034
<input type="checkbox" class="person_list" name="person.counselor" />
1035
<input type="checkbox" class="person_list" name="person.principal" />
1036
<input type="checkbox" class="person_list" name="person.teacher1" />
1037
>>> analyze.printQuery('//table//tr[2]//td[2]//span', manager.contents)
1039
<b>Student1 Student1</b>
1042
<b>Parent1 Parent1 (parent)</b>
1044
>>> analyze.printQuery('//table//tr[2]//td[2]//input[@type="checkbox"]', manager.contents)
1045
<input type="checkbox" name="person.student1" />
1046
<input type="checkbox" name="person.student1:1" />
1049
Intervention CSV views
1050
----------------------
1052
We supply CSV views for extracting the messages and goals from a schooltool
1055
>>> manager.open('http://localhost/messages.csv')
1056
>>> print manager.contents
1057
"year","student","date","sender","recipients","body"
1058
"2005-2006","student1","...","manager","parent@somewhere.com, teacher1@example.com","hi\nthere"
1059
"2005-2006","student1","...","manager","teacher1@example.com, teacher2@example.com","hello again"
1060
"2005-2006","student1","...","manager","teacher1@example.com","hello"
1061
"2005-2006","student3","...","manager","teacher1@example.com","Message for Student3"
1063
>>> manager.open('http://localhost/goals.csv')
1064
>>> print manager.contents
1065
"year","student","created","creator","presenting_concerns","goal","strengths","indicators","intervention","timeline","persons_responsible","goal_met","follow_up_notes","notified"
1066
"2005-2006","student1","...","manager","Poor attendence","Get student to come in more often","Good listener","Student appears at least 4 time a week","Call parents to arrange better attendence","...","parent@somewhere.com, student1@example.com, teacher1@example.com","True","","True"
1067
"2005-2006","student1","...","manager","Rude behavior","Get student to be more polite","Good grades","Student no longer offends classmates","Call parents to alert them to bad manners","...","teacher2@example.com","False","","True"