1
IEP functionality for the Student Competency Report
2
===================================================
6
>>> def print_report_skills(browser):
7
... sel = '.student-scr tbody tr'
8
... for row in browser.query_all.css(sel):
9
... tds = row.query_all.tag('td')
11
... print '%s, %s, %s' % (tds[0].text, tds[1].text, tds[2].text)
15
>>> manager = browsers.manager
16
>>> manager.ui.login('manager', 'schooltool')
20
>>> manager.ui.person.add('Jeffrey', 'Elkner', 'jeffrey', 'pwd')
21
>>> manager.ui.person.add('Camila', 'Cerna', 'camila', 'pwd')
22
>>> camila_url = manager.url
23
>>> manager.ui.person.add('Liliana', 'Vividor', 'liliana', 'pwd')
24
>>> manager.ui.person.add('Mario', 'Tejada', 'mario', 'pwd')
28
>>> manager.ui.schoolyear.add('2012', '2012-01-01', '2012-12-31')
29
>>> manager.ui.term.add('2012', '2012', '2012-01-01', '2012-12-31')
30
>>> manager.ui.course.add('2012', 'Programming', course_id='PRO')
31
>>> manager.ui.section.add('2012', '2012', 'Programming')
32
>>> manager.ui.section.instructors.add('2012', '2012', 'Programming (1)',
34
>>> manager.ui.section.students.add('2012', '2012', 'Programming (1)',
35
... ['camila', 'liliana', 'mario'])
39
>>> manager.ui.layer.add('Course')
40
>>> manager.ui.node.add('Programming', label='PRO')
42
>>> manager.ui.skillset.add('Python Environment', '01')
43
>>> manager.ui.skillset.add('Data Types, Statements, and Expressions', '02')
44
>>> manager.ui.skillset.add('Errors', '03')
45
>>> manager.ui.skillset.add('Strings', '04')
47
>>> manager.ui.skill.add(
48
... 'Python Environment',
49
... 'Use the Python shell for interactive evaluation',
51
>>> manager.ui.skill.add(
52
... 'Python Environment',
53
... 'Make Python scripts with a text editor',
56
>>> manager.ui.skill.add(
57
... 'Data Types, Statements, and Expressions',
58
... 'Recognize int, float, str, list, tuple, and dict.',
60
>>> manager.ui.skill.add(
61
... 'Data Types, Statements, and Expressions',
62
... 'Use type(...) to determine the data type of a given value.',
64
>>> manager.ui.skill.add(
65
... 'Data Types, Statements, and Expressions',
66
... 'Use assignment statements to assign names (variables) to values.',
68
>>> manager.ui.skill.add(
69
... 'Data Types, Statements, and Expressions',
70
... 'Use the input function to read user input.',
72
>>> manager.ui.skill.add(
73
... 'Data Types, Statements, and Expressions',
74
... 'Define keyword and recognize keywords in Python.',
76
>>> manager.ui.skill.add(
77
... 'Data Types, Statements, and Expressions',
78
... 'Create legal variable names and recognize illegal ones.',
81
>>> manager.ui.skill.add(
83
... 'Recognize and differentiate among errors.',
85
>>> manager.ui.skill.add(
87
... 'Read and interpret stack traceback messages.',
89
>>> manager.ui.skill.add(
91
... 'Create string literals with single, double, and triple quotes.',
93
>>> manager.ui.skill.add(
95
... 'Use the len() function to return the length of a string.',
97
>>> manager.ui.skill.add(
99
... 'Use the find(...) method to locate substrings in a string.',
102
>>> manager.ui.skill.add(
104
... 'Use the split() method to break a string into a list.',
108
>>> manager.query.link('Search').click()
109
>>> manager.query.button('Search').click()
110
>>> manager.query.link('Programming').click()
112
>>> sel = '//h2[contains(@class, "ui-accordion-header")]'
113
>>> accordion_headers = manager.query_all.xpath(sel)
114
>>> sel = 'div.ui-accordion-content'
115
>>> accordion_contents = manager.query_all.css(sel)
116
>>> information_accordion_content = accordion_contents[0]
117
>>> skillsets_accordion_header = accordion_headers[4]
118
>>> skillsets_accordion_header.click()
119
>>> skillsets_accordion_content = accordion_contents[4]
120
>>> manager.wait_no(information_accordion_content.is_displayed)
121
>>> sel = '//a[@title="Edit skillsets"]'
122
>>> manager.query.xpath(sel).click()
123
>>> manager.query.id('form-buttons-add').click()
124
>>> manager.query.link('Done').click()
126
>>> sel = '//h2[contains(@class, "ui-accordion-header")]'
127
>>> accordion_headers = manager.query_all.xpath(sel)
128
>>> sel = 'div.ui-accordion-content'
129
>>> accordion_contents = manager.query_all.css(sel)
130
>>> information_accordion_content = accordion_contents[0]
131
>>> layers_accordion_header = accordion_headers[3]
132
>>> layers_accordion_header.click()
133
>>> layers_accordion_content = accordion_contents[3]
134
>>> manager.wait_no(information_accordion_content.is_displayed)
135
>>> sel = '//a[@title="Edit layers"]'
136
>>> manager.query.xpath(sel).click()
137
>>> manager.query.id('form-buttons-add').click()
139
Assign the skills to the course:
141
>>> manager.query.link('School').click()
142
>>> manager.query.link('Courses').click()
143
>>> manager.query.link('Batch Assign Skills').click()
144
>>> manager.query.name('course_attr').ui.set_value('Course ID')
145
>>> manager.query.name('layer').ui.set_value('Course')
146
>>> manager.query.name('node_attr').ui.set_value('Label')
147
>>> manager.query.name('SEARCH_BUTTON').click()
148
>>> manager.query.name('ASSIGN_BUTTON').click()
150
Log in as instructor:
152
>>> teacher = browsers.teacher
153
>>> teacher.ui.login('jeffrey', 'pwd')
154
>>> teacher.query.link('CanDo').click()
156
Check Camila's Student Competency Report and print its skills
157
information (label, required, title):
159
>>> sel = '#students-part tbody ul.popup_menu'
160
>>> camila_menu, mario_menu, liliana_menu = teacher.query_all.css(sel)
161
>>> teacher.query.link('Cerna, Camila').click()
162
>>> camila_menu.query.link('Report').click()
163
>>> camila_report_url = teacher.url
165
>>> print_report_skills(teacher)
166
01, Yes, Use the Python shell for interactive evaluation
167
02, No, Make Python scripts with a text editor
168
03, Yes, Recognize int, float, str, list, tuple, and dict.
169
04, Yes, Use type(...) to determine the data type of a given value.
170
05, Yes, Use assignment statements to assign names (variables) to values.
171
06, Yes, Use the input function to read user input.
172
07, Yes, Define keyword and recognize keywords in Python.
173
08, No, Create legal variable names and recognize illegal ones.
174
09, Yes, Recognize and differentiate among errors.
175
10, Yes, Read and interpret stack traceback messages.
176
11, Yes, Create string literals with single, double, and triple quotes.
177
12, Yes, Use the len() function to return the length of a string.
178
13, No, Use the find(...) method to locate substrings in a string.
179
14, No, Use the split() method to break a string into a list.
181
Let's activate IEP for Camila:
183
>>> manager.open(camila_url)
184
>>> manager.query.link('IEP').click()
185
>>> sel = 'a[title="Edit this plan information"]'
186
>>> manager.query.css(sel).click()
187
>>> manager.query.id('form-widgets-active-0').click()
188
>>> manager.query.id('form-buttons-add').click()
190
And customize some of the required skills:
192
>>> manager.query.link('Programming (1)').click()
193
>>> sel = '''a[title="Edit student's IEP skills"]'''
194
>>> manager.query.css(sel).click()
195
>>> sel = 'iep_section_skills.iep.Python E1.Use the 1'
196
>>> manager.query.id(sel).click()
197
>>> sel = 'iep_section_skills.iep.Data Typ2.Use the 4'
198
>>> manager.query.id(sel).click()
199
>>> sel = 'iep_section_skills.iep.Errors-3.Recogniz1'
200
>>> manager.query.id(sel).click()
201
>>> manager.query.name('SAVE').click()
203
And check her report again. The IEP skills should be shown as not
206
>>> teacher.open(camila_report_url)
207
>>> print_report_skills(teacher)
208
01, No, Use the Python shell for interactive evaluation
209
02, No, Make Python scripts with a text editor
210
03, Yes, Recognize int, float, str, list, tuple, and dict.
211
04, Yes, Use type(...) to determine the data type of a given value.
212
05, Yes, Use assignment statements to assign names (variables) to values.
213
06, No, Use the input function to read user input.
214
07, Yes, Define keyword and recognize keywords in Python.
215
08, No, Create legal variable names and recognize illegal ones.
216
09, No, Recognize and differentiate among errors.
217
10, Yes, Read and interpret stack traceback messages.
218
11, Yes, Create string literals with single, double, and triple quotes.
219
12, Yes, Use the len() function to return the length of a string.
220
13, No, Use the find(...) method to locate substrings in a string.
221
14, No, Use the split() method to break a string into a list.