1 | Batch processing via browser |
---|
2 | **************************** |
---|
3 | |
---|
4 | Preliminaries: |
---|
5 | |
---|
6 | We define a function that looks up a form with several submit buttons |
---|
7 | for the one with a given value (this functionality is missing in |
---|
8 | zope.testbrowser): |
---|
9 | |
---|
10 | >>> def lookup_submit_value(name, value, browser): |
---|
11 | ... """Find a button with a certain value.""" |
---|
12 | ... for num in range(0, 100): |
---|
13 | ... try: |
---|
14 | ... button = browser.getControl(name=name, index=num) |
---|
15 | ... if button.value.endswith(value): |
---|
16 | ... return button |
---|
17 | ... except IndexError: |
---|
18 | ... break |
---|
19 | ... return None |
---|
20 | |
---|
21 | Create a site: |
---|
22 | |
---|
23 | >>> from waeup.sirp.app import University |
---|
24 | >>> getRootFolder()['app'] = University() |
---|
25 | |
---|
26 | Create a datacenter storage path: |
---|
27 | |
---|
28 | >>> import os |
---|
29 | >>> import tempfile |
---|
30 | >>> dc_path = tempfile.mkdtemp() |
---|
31 | |
---|
32 | Log in: |
---|
33 | |
---|
34 | >>> from zope.testbrowser.testing import Browser |
---|
35 | >>> browser = Browser() |
---|
36 | >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw') |
---|
37 | >>> browser.handleErrors = False |
---|
38 | |
---|
39 | Set datacenter path and deselect moving old data: |
---|
40 | |
---|
41 | >>> browser.open('http://localhost/app') |
---|
42 | >>> browser.getLink('Data Center').click() |
---|
43 | >>> browser.getLink('Edit settings').click() |
---|
44 | >>> browser.getControl(name='newpath').value = dc_path |
---|
45 | >>> browser.getControl(name='move').value = False |
---|
46 | >>> browser.getControl(name='save').click() |
---|
47 | |
---|
48 | Set non-usable datacenter path: |
---|
49 | |
---|
50 | >>> browser.getLink('Edit settings').click() |
---|
51 | >>> browser.getControl(name='newpath').value = '/' |
---|
52 | >>> browser.getControl(name='save').click() |
---|
53 | >>> 'Given storage path cannot be used.' in browser.contents |
---|
54 | True |
---|
55 | >>> browser.getControl('Cancel').click() |
---|
56 | |
---|
57 | |
---|
58 | Batch processing faculties |
---|
59 | ========================== |
---|
60 | |
---|
61 | Go to datacenter page: |
---|
62 | |
---|
63 | >>> browser.open('http://localhost/app/datacenter') |
---|
64 | |
---|
65 | Prepare a CSV file for faculties: |
---|
66 | |
---|
67 | >>> open('faculties.csv', 'wb').write( |
---|
68 | ... """code,title,title_prefix |
---|
69 | ... FAC1,Faculty 1,faculty |
---|
70 | ... FAC2,Faculty 2,institute |
---|
71 | ... FAC3,Faculty 3,school |
---|
72 | ... """) |
---|
73 | |
---|
74 | Upload the file: |
---|
75 | |
---|
76 | >>> import cStringIO |
---|
77 | >>> browser.getLink('Upload CSV file').click() |
---|
78 | >>> filecontents = cStringIO.StringIO( |
---|
79 | ... open('faculties.csv', 'rb').read()) |
---|
80 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
81 | >>> filewidget.add_file(filecontents, 'text/plain', 'faculties.csv') |
---|
82 | >>> browser.getControl(name='SUBMIT').click() |
---|
83 | |
---|
84 | Step 1: start batch processing: |
---|
85 | |
---|
86 | >>> browser.getLink('Batch processing').click() |
---|
87 | >>> button = lookup_submit_value( |
---|
88 | ... 'select', 'faculties_zope.mgr.csv', browser) |
---|
89 | >>> button.click() |
---|
90 | |
---|
91 | Step 2: select a processor and mode: |
---|
92 | |
---|
93 | >>> importerselect = browser.getControl(name='importer') |
---|
94 | >>> importerselect.displayOptions |
---|
95 | ['Applicant Importer', |
---|
96 | 'Applicants Container Importer', |
---|
97 | 'CourseTicket Importer', |
---|
98 | 'Payment Importer', |
---|
99 | 'Student Importer', |
---|
100 | 'StudentStudyCourse Importer (update only)', |
---|
101 | 'StudentStudyLevel Importer', |
---|
102 | 'CertificateCourse Importer', |
---|
103 | 'Certificate Importer', |
---|
104 | 'Course Importer', |
---|
105 | 'Department Importer', |
---|
106 | 'Faculty Importer'] |
---|
107 | |
---|
108 | >>> importerselect.getControl('Faculty Importer').selected = True |
---|
109 | |
---|
110 | >>> modeselect = browser.getControl(name='mode') |
---|
111 | >>> modeselect.options |
---|
112 | ['create', 'update', 'remove'] |
---|
113 | |
---|
114 | >>> modeselect.getControl(value='create').selected = True |
---|
115 | >>> browser.getControl('Proceed to step 3').click() |
---|
116 | |
---|
117 | Step 3: Fix headerlines |
---|
118 | |
---|
119 | We get informed that there are no problems with the current header: |
---|
120 | |
---|
121 | >>> print browser.contents |
---|
122 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
123 | ... |
---|
124 | Header fields OK |
---|
125 | ... |
---|
126 | |
---|
127 | The submit button is enabled: |
---|
128 | |
---|
129 | >>> browser.getControl('Perform import').disabled |
---|
130 | False |
---|
131 | |
---|
132 | >>> browser.getControl('Perform import').click() |
---|
133 | |
---|
134 | Step 4: See import results |
---|
135 | |
---|
136 | The import was successful: |
---|
137 | |
---|
138 | >>> print browser.contents |
---|
139 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
140 | ...Successfully processed 3 rows... |
---|
141 | ...Batch processing finished... |
---|
142 | ...File:...faculties_zope.mgr.csv... |
---|
143 | |
---|
144 | We can watch the entries generated in logfile: |
---|
145 | |
---|
146 | >>> browser.getControl('View processing log').click() |
---|
147 | >>> print browser.contents |
---|
148 | <!DOCTYPE ... |
---|
149 | <pre>... |
---|
150 | |
---|
151 | ... - INFO - -------------------- |
---|
152 | ... - INFO - zope.mgr: Batch processing finished: OK |
---|
153 | ... - INFO - zope.mgr: Source: /.../faculties_zope.mgr.csv |
---|
154 | ... - INFO - zope.mgr: Mode: create |
---|
155 | ... - INFO - zope.mgr: User: zope.mgr |
---|
156 | ... - INFO - zope.mgr: Processing time: ... s (... s/item) |
---|
157 | ... - INFO - zope.mgr: Processed: 3 lines (3 successful/ 0 failed) |
---|
158 | ... - INFO - -------------------- |
---|
159 | </pre> |
---|
160 | .... |
---|
161 | |
---|
162 | |
---|
163 | Batch processing departments |
---|
164 | ============================ |
---|
165 | |
---|
166 | >>> browser.open('http://localhost/app/datacenter') |
---|
167 | |
---|
168 | Prepare a CSV file for departments: |
---|
169 | |
---|
170 | >>> open('departments.csv', 'wb').write( |
---|
171 | ... """code,faculty_code,title,title_prefix |
---|
172 | ... DEP1,FAC1,Department 1,department |
---|
173 | ... DEP2,FAC2,Department 2,centre |
---|
174 | ... """) |
---|
175 | |
---|
176 | Upload the file: |
---|
177 | |
---|
178 | >>> import cStringIO |
---|
179 | >>> browser.getLink('Upload CSV file').click() |
---|
180 | >>> filecontents = cStringIO.StringIO( |
---|
181 | ... open('departments.csv', 'rb').read()) |
---|
182 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
183 | >>> filewidget.add_file(filecontents, 'text/plain', 'departments.csv') |
---|
184 | >>> browser.getControl(name='SUBMIT').click() |
---|
185 | |
---|
186 | Step 1: start batch processing: |
---|
187 | |
---|
188 | >>> browser.getLink('Batch processing').click() |
---|
189 | >>> button = lookup_submit_value( |
---|
190 | ... 'select', 'departments_zope.mgr.csv', browser) |
---|
191 | >>> button.click() |
---|
192 | |
---|
193 | Step 2: select a processor and mode: |
---|
194 | |
---|
195 | >>> importerselect = browser.getControl(name='importer') |
---|
196 | >>> importerselect.getControl('Department Importer').selected = True |
---|
197 | >>> modeselect = browser.getControl(name='mode') |
---|
198 | >>> modeselect.getControl(value='create').selected = True |
---|
199 | >>> browser.getControl('Proceed to step 3').click() |
---|
200 | |
---|
201 | Step 3: Fix headerlines |
---|
202 | |
---|
203 | We get informed that there are no problems with the current header: |
---|
204 | |
---|
205 | >>> print browser.contents |
---|
206 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
207 | ... |
---|
208 | Header fields OK |
---|
209 | ... |
---|
210 | |
---|
211 | The submit button is enabled: |
---|
212 | |
---|
213 | >>> browser.getControl('Perform import').disabled |
---|
214 | False |
---|
215 | |
---|
216 | >>> browser.getControl('Perform import').click() |
---|
217 | |
---|
218 | Step 4: See import results |
---|
219 | |
---|
220 | The import was successful: |
---|
221 | |
---|
222 | >>> print browser.contents |
---|
223 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
224 | ...Successfully processed 2 rows... |
---|
225 | ...Batch processing finished... |
---|
226 | ...File:...departments_zope.mgr.csv... |
---|
227 | |
---|
228 | Batch processing courses |
---|
229 | ======================== |
---|
230 | |
---|
231 | >>> browser.open('http://localhost/app/datacenter') |
---|
232 | |
---|
233 | Prepare a CSV file for courses: |
---|
234 | |
---|
235 | >>> open('courses.csv', 'wb').write( |
---|
236 | ... """code,faculty_code,department_code,title,level,passmark,credits,semester |
---|
237 | ... CRS1,FAC1,DEP1,Course 1,100,40,2,1 |
---|
238 | ... CRS2,FAC1,DEP1,Course 2,100,40,2,2 |
---|
239 | ... """) |
---|
240 | |
---|
241 | Upload the file: |
---|
242 | |
---|
243 | >>> import cStringIO |
---|
244 | >>> browser.getLink('Upload CSV file').click() |
---|
245 | >>> filecontents = cStringIO.StringIO( |
---|
246 | ... open('courses.csv', 'rb').read()) |
---|
247 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
248 | >>> filewidget.add_file(filecontents, 'text/plain', 'courses.csv') |
---|
249 | >>> browser.getControl(name='SUBMIT').click() |
---|
250 | |
---|
251 | Step 1: start batch processing: |
---|
252 | |
---|
253 | >>> browser.getLink('Batch processing').click() |
---|
254 | >>> button = lookup_submit_value( |
---|
255 | ... 'select', 'courses_zope.mgr.csv', browser) |
---|
256 | >>> button.click() |
---|
257 | |
---|
258 | Step 2: select a processor and mode: |
---|
259 | |
---|
260 | >>> importerselect = browser.getControl(name='importer') |
---|
261 | >>> importerselect.getControl('Course Importer', index=2).selected = True |
---|
262 | >>> modeselect = browser.getControl(name='mode') |
---|
263 | >>> modeselect.getControl(value='create').selected = True |
---|
264 | >>> browser.getControl('Proceed to step 3').click() |
---|
265 | |
---|
266 | Step 3: Fix headerlines |
---|
267 | |
---|
268 | We get informed that there are no problems with the current header: |
---|
269 | |
---|
270 | >>> print browser.contents |
---|
271 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
272 | ... |
---|
273 | Header fields OK |
---|
274 | ... |
---|
275 | |
---|
276 | The submit button is enabled: |
---|
277 | |
---|
278 | >>> browser.getControl('Perform import').disabled |
---|
279 | False |
---|
280 | |
---|
281 | >>> browser.getControl('Perform import').click() |
---|
282 | |
---|
283 | Step 4: See import results |
---|
284 | |
---|
285 | The import was successful: |
---|
286 | |
---|
287 | >>> print browser.contents |
---|
288 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
289 | ...Successfully processed 2 rows... |
---|
290 | ...Batch processing finished... |
---|
291 | ...File:...courses_zope.mgr.csv... |
---|
292 | |
---|
293 | Batch processing certificates |
---|
294 | ============================= |
---|
295 | |
---|
296 | >>> browser.open('http://localhost/app/datacenter') |
---|
297 | |
---|
298 | Prepare a CSV file for certificates: |
---|
299 | |
---|
300 | >>> open('certificates.csv', 'wb').write( |
---|
301 | ... """code,faculty_code,department_code,title,study_mode,start_level,end_level,application_category |
---|
302 | ... CERT1,FAC1,DEP1,Certificate 1,ug_ft,100,300,basic |
---|
303 | ... CERT2,FAC1,DEP1,Certificate 2,ug_ft,200,300,cest |
---|
304 | ... """) |
---|
305 | |
---|
306 | Upload the file: |
---|
307 | |
---|
308 | >>> import cStringIO |
---|
309 | >>> browser.getLink('Upload CSV file').click() |
---|
310 | >>> filecontents = cStringIO.StringIO( |
---|
311 | ... open('certificates.csv', 'rb').read()) |
---|
312 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
313 | >>> filewidget.add_file(filecontents, 'text/plain', 'certificates.csv') |
---|
314 | >>> browser.getControl(name='SUBMIT').click() |
---|
315 | |
---|
316 | Step 1: start batch processing: |
---|
317 | |
---|
318 | >>> browser.getLink('Batch processing').click() |
---|
319 | >>> button = lookup_submit_value( |
---|
320 | ... 'select', 'certificates_zope.mgr.csv', browser) |
---|
321 | >>> button.click() |
---|
322 | |
---|
323 | |
---|
324 | Step 2: select a processor and mode: |
---|
325 | |
---|
326 | >>> importerselect = browser.getControl(name='importer') |
---|
327 | >>> importerselect.getControl('Certificate Importer').selected = True |
---|
328 | >>> modeselect = browser.getControl(name='mode') |
---|
329 | >>> modeselect.getControl(value='create').selected = True |
---|
330 | >>> browser.getControl('Proceed to step 3').click() |
---|
331 | |
---|
332 | Step 3: Fix headerlines |
---|
333 | |
---|
334 | We get informed that there are no problems with the current header: |
---|
335 | |
---|
336 | >>> print browser.contents |
---|
337 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
338 | ... |
---|
339 | Header fields OK |
---|
340 | ... |
---|
341 | |
---|
342 | The submit button is enabled: |
---|
343 | |
---|
344 | >>> browser.getControl('Perform import').disabled |
---|
345 | False |
---|
346 | |
---|
347 | >>> browser.getControl('Perform import').click() |
---|
348 | |
---|
349 | Step 4: See import results |
---|
350 | |
---|
351 | The import was successful: |
---|
352 | |
---|
353 | >>> print browser.contents |
---|
354 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
355 | ...Successfully processed 2 rows... |
---|
356 | ...Batch processing finished... |
---|
357 | ...File:...certificates_zope.mgr.csv... |
---|
358 | |
---|
359 | Batch processing certificate courses |
---|
360 | ==================================== |
---|
361 | |
---|
362 | >>> browser.open('http://localhost/app/datacenter') |
---|
363 | |
---|
364 | Prepare a CSV file for certificate courses: |
---|
365 | |
---|
366 | >>> open('mycertcourses.csv', 'wb').write( |
---|
367 | ... """course,faculty_code,department_code,certificate_code,level,mandatory |
---|
368 | ... CRS1,FAC1,DEP1,CERT1,100,True |
---|
369 | ... CRS2,FAC1,DEP1,CERT1,100,True |
---|
370 | ... """) |
---|
371 | |
---|
372 | Upload the file: |
---|
373 | |
---|
374 | >>> import cStringIO |
---|
375 | >>> browser.getLink('Upload CSV file').click() |
---|
376 | >>> filecontents = cStringIO.StringIO( |
---|
377 | ... open('mycertcourses.csv', 'rb').read()) |
---|
378 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
379 | >>> filewidget.add_file(filecontents, 'text/plain', 'mycertcourses.csv') |
---|
380 | >>> browser.getControl(name='SUBMIT').click() |
---|
381 | |
---|
382 | Step 1: start batch processing: |
---|
383 | |
---|
384 | >>> browser.getLink('Batch processing').click() |
---|
385 | >>> button = lookup_submit_value( |
---|
386 | ... 'select', 'mycertcourses_zope.mgr.csv', browser) |
---|
387 | >>> button.click() |
---|
388 | |
---|
389 | Step 2: select a processor and mode: |
---|
390 | |
---|
391 | >>> importerselect = browser.getControl(name='importer') |
---|
392 | >>> importerselect.getControl('CertificateCourse Importer').selected = True |
---|
393 | >>> modeselect = browser.getControl(name='mode') |
---|
394 | >>> modeselect.getControl(value='create').selected = True |
---|
395 | >>> browser.getControl('Proceed to step 3').click() |
---|
396 | |
---|
397 | Step 3: Fix headerlines |
---|
398 | |
---|
399 | We get informed that there are no problems with the current header: |
---|
400 | |
---|
401 | >>> print browser.contents |
---|
402 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
403 | ... |
---|
404 | Header fields OK |
---|
405 | ... |
---|
406 | |
---|
407 | The submit button is enabled: |
---|
408 | |
---|
409 | >>> browser.getControl('Perform import').disabled |
---|
410 | False |
---|
411 | |
---|
412 | >>> browser.getControl('Perform import').click() |
---|
413 | |
---|
414 | Step 4: See import results |
---|
415 | |
---|
416 | The import was successful: |
---|
417 | |
---|
418 | >>> print browser.contents |
---|
419 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
---|
420 | ...Successfully processed 2 rows... |
---|
421 | ...Batch processing finished... |
---|
422 | ...File:...mycertcourses_zope.mgr.csv... |
---|
423 | |
---|
424 | |
---|
425 | Pending files |
---|
426 | ============= |
---|
427 | |
---|
428 | When an error occurs during an import, two files are generated: a CSV |
---|
429 | file with finished files and a CSV file with pending data. Both are |
---|
430 | stored in the appropriate subdirectories in datacenter. We try to |
---|
431 | create faculties, from which one already exists. |
---|
432 | |
---|
433 | Go to datacenter page: |
---|
434 | |
---|
435 | >>> browser.open('http://localhost/app/datacenter') |
---|
436 | |
---|
437 | Prepare a CSV file for faculties: |
---|
438 | |
---|
439 | >>> open('newfaculties.csv', 'wb').write( |
---|
440 | ... """code,title,title_prefix |
---|
441 | ... FAC1,Faculty 1,faculty |
---|
442 | ... FAC4,Faculty 4,school |
---|
443 | ... """) |
---|
444 | |
---|
445 | Upload the file: |
---|
446 | |
---|
447 | >>> import cStringIO |
---|
448 | >>> browser.getLink('Upload CSV file').click() |
---|
449 | >>> filecontents = cStringIO.StringIO( |
---|
450 | ... open('newfaculties.csv', 'rb').read()) |
---|
451 | >>> filewidget = browser.getControl(name='uploadfile:file') |
---|
452 | >>> filewidget.add_file(filecontents, 'text/plain', 'newfaculties.csv') |
---|
453 | >>> browser.getControl(name='SUBMIT').click() |
---|
454 | |
---|
455 | Step 1: start batch processing: |
---|
456 | |
---|
457 | >>> browser.getLink('Batch processing').click() |
---|
458 | >>> button = lookup_submit_value( |
---|
459 | ... 'select', 'newfaculties_zope.mgr.csv', browser) |
---|
460 | >>> button.click() |
---|
461 | |
---|
462 | Step 2: select a processor and mode: |
---|
463 | |
---|
464 | >>> importerselect = browser.getControl(name='importer') |
---|
465 | >>> importerselect.getControl('Faculty Importer').selected = True |
---|
466 | >>> modeselect = browser.getControl(name='mode') |
---|
467 | >>> modeselect.getControl(value='create').selected = True |
---|
468 | >>> browser.getControl('Proceed to step 3').click() |
---|
469 | |
---|
470 | Step 3: Fix headerlines |
---|
471 | |
---|
472 | As there should be no problem with the headers, we can immediately |
---|
473 | perfom the import: |
---|
474 | |
---|
475 | >>> browser.getControl('Perform import').click() |
---|
476 | |
---|
477 | One line could not be imported: |
---|
478 | |
---|
479 | >>> print browser.contents |
---|
480 | <!DOCTYPE html PUBLIC... |
---|
481 | ... |
---|
482 | ...Processing of 1 rows failed... |
---|
483 | ...Successfully processed 1 rows... |
---|
484 | ... |
---|
485 | |
---|
486 | Now there are two files as a result in datacenter storage's root and |
---|
487 | ``finished`` dirs: |
---|
488 | |
---|
489 | >>> pending_file = dc_path + '/newfaculties_zope.mgr.create.pending.csv' |
---|
490 | >>> print open(pending_file).read() |
---|
491 | title_prefix,code,title,--ERRORS-- |
---|
492 | faculty,FAC1,Faculty 1,This object already exists in the same container. Skipping. |
---|
493 | |
---|
494 | >>> finished_file = dc_path + '/finished/newfaculties_zope.mgr.create.finished.csv' |
---|
495 | >>> print open(finished_file).read() |
---|
496 | title_prefix,code,title |
---|
497 | school,FAC4,Faculty 4 |
---|
498 | |
---|
499 | The finished-file contains the dataset we could import, while the |
---|
500 | pending file contains the dataset that failed, appended by an error |
---|
501 | message. |
---|
502 | |
---|
503 | |
---|
504 | Fixing the pending file |
---|
505 | ----------------------- |
---|
506 | |
---|
507 | We 'edit' the pending file (setting code to ``FAC5`` and title |
---|
508 | appropriately, and removing the --ERROR-- column) and finish the |
---|
509 | import this way: |
---|
510 | |
---|
511 | >>> open(dc_path + '/newfaculties_zope.mgr.create.pending.csv', 'wb').write( |
---|
512 | ... """title_prefix,--IGNORE--,code,title |
---|
513 | ... faculty,FAC5,Faculty 5 |
---|
514 | ... """) |
---|
515 | |
---|
516 | Step 1: start batch processing: |
---|
517 | |
---|
518 | >>> browser.open('http://localhost/app/datacenter') |
---|
519 | >>> browser.getLink('Batch processing').click() |
---|
520 | >>> button = lookup_submit_value( |
---|
521 | ... 'select', 'newfaculties_zope.mgr.create.pending.csv', browser) |
---|
522 | >>> button.click() |
---|
523 | |
---|
524 | Step 2: select a processor and mode: |
---|
525 | |
---|
526 | >>> importerselect = browser.getControl(name='importer') |
---|
527 | >>> importerselect.getControl('Faculty Importer').selected = True |
---|
528 | >>> modeselect = browser.getControl(name='mode') |
---|
529 | >>> modeselect.getControl(value='create').selected = True |
---|
530 | >>> browser.getControl('Proceed to step 3').click() |
---|
531 | |
---|
532 | Step 3/4: Fix headerlines and import: |
---|
533 | |
---|
534 | As there should be no problem with the headers, we can immediately |
---|
535 | perfom the import: |
---|
536 | |
---|
537 | >>> browser.getControl('Perform import').click() |
---|
538 | |
---|
539 | This time everything should work: |
---|
540 | |
---|
541 | >>> print browser.contents |
---|
542 | <!DOCTYPE html PUBLIC... |
---|
543 | ... |
---|
544 | ...Successfully processed 1 rows... |
---|
545 | ... |
---|
546 | |
---|
547 | >>> sorted(os.listdir(dc_path)) |
---|
548 | ['finished', 'logs', 'unfinished'] |
---|
549 | |
---|
550 | >>> os.listdir(dc_path + '/unfinished') |
---|
551 | [] |
---|
552 | |
---|
553 | >>> sorted(os.listdir(dc_path + '/finished')) |
---|
554 | ['certificates_zope.mgr.create.finished.csv', ..., |
---|
555 | 'newfaculties_zope.mgr.create.finished.csv', |
---|
556 | 'newfaculties_zope.mgr.csv'] |
---|
557 | |
---|
558 | |
---|
559 | Log Files |
---|
560 | ========= |
---|
561 | |
---|
562 | >>> browser.open('http://localhost/app/datacenter/logs') |
---|
563 | >>> 'datacenter.log' in browser.contents |
---|
564 | True |
---|
565 | >>> browser.getControl('Show', index=0).click() |
---|
566 | >>> '<input class="btn primary" type="submit" name="back" value="Back" />' in browser.contents |
---|
567 | True |
---|
568 | >>> browser.getControl('Back', index=0).click() |
---|
569 | >>> browser.getControl('Back to Data Center').click() |
---|
570 | >>> 'Storage path:' in browser.contents |
---|
571 | True |
---|
572 | |
---|
573 | |
---|
574 | Clean up: |
---|
575 | |
---|
576 | >>> import shutil |
---|
577 | >>> shutil.rmtree(dc_path) |
---|