Changeset 4899 for waeup/trunk/src/waeup


Ignore:
Timestamp:
27 Jan 2010, 11:41:24 (15 years ago)
Author:
uli
Message:

Update tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/browser/batchprocessing.txt

    r4888 r4899  
    1515    ...     try:
    1616    ...       button = browser.getControl(name=name, index=num)
    17     ...       if button.value == value:
     17    ...       if button.value.endswith(value):
    1818    ...         return button
    1919    ...     except IndexError:
     
    408408
    409409
     410Pending files
     411=============
     412
     413When an error occurs during an import, two files are generated: a CSV
     414file with finished files and a CSV file with pending data. Both are
     415stored in the appropriate subdirectories in datacenter. We try to
     416create faculties, from which one already exists.
     417
     418Go to datacenter page:
     419
     420    >>> browser.open('http://localhost/app/datacenter')
     421
     422Prepare a CSV file for faculties:
     423
     424    >>> open('newfaculties.csv', 'wb').write(
     425    ... """code,review_state,title,title_prefix
     426    ... FAC1,static,Faculty 1,faculty
     427    ... FAC4,static,Faculty 4,school
     428    ... """)
     429
     430Upload the file:
     431
     432    >>> import cStringIO
     433    >>> browser.getLink('Upload data').click()
     434    >>> filecontents = cStringIO.StringIO(
     435    ...   open('newfaculties.csv', 'rb').read())
     436    >>> filewidget = browser.getControl(name='uploadfile:file')
     437    >>> filewidget.add_file(filecontents, 'text/plain', 'newfaculties.csv')
     438    >>> browser.getControl(name='SUBMIT').click()
     439
     440Step 1: start batch processing:
     441
     442    >>> browser.getLink('Batch processing').click()
     443    >>> button = lookup_submit_value(
     444    ...   'select', 'newfaculties_zope.mgr.csv', browser)
     445    >>> button.click()
     446
     447Step 2: select a processor and mode:
     448
     449    >>> importerselect = browser.getControl(name='importer')
     450    >>> importerselect.getControl('Faculty importer').selected = True
     451    >>> modeselect = browser.getControl(name='mode')
     452    >>> modeselect.getControl(value='create').selected = True
     453    >>> browser.getControl('Proceed to step 3...').click()
     454
     455Step 3: Fix headerlines
     456
     457As there should be no problem with the headers, we can immediately
     458perfom the import:
     459
     460    >>> browser.getControl('Perform import...').click()
     461
     462One line could not be imported:
     463
     464    >>> print browser.contents
     465    <!DOCTYPE html PUBLIC...
     466    ...
     467    ...Processing of 1 rows failed!...
     468    ...Successfully processed 1 rows...
     469    ...
     470
     471Now there are two files as a result in datacenter storage's root and
     472``finished`` dirs:
     473
     474    >>> pending_file = dc_path + '/newfaculties_zope.mgr.pending.csv'
     475    >>> print open(pending_file).read()
     476    title_prefix,--IGNORE--,code,title,--ERRORS--
     477    faculty,static,FAC1,Faculty 1,This object already exists. Skipping.
     478
     479    >>> finished_file = dc_path + '/finished/newfaculties_zope.mgr.finished.csv'
     480    >>> print open(finished_file).read()
     481    title_prefix,--IGNORE--,code,title
     482    school,static,FAC4,Faculty 4
     483
     484The finished-file contains the dataset we could import, while the
     485pending file contains the dataset that failed, appended by an error
     486message.
     487
     488
    410489Clean up:
    411490
Note: See TracChangeset for help on using the changeset viewer.