Changeset 4895 for waeup/trunk


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

Update tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/utils/batching.txt

    r4890 r4895  
    229229    ...                   ['name', 'dinoports', 'owner', 'taxpayer'],
    230230    ...                    mode='create', user='Bob', logger=logger)
    231     (4, 0)
     231    (4, 0, '/.../newcomers.finished.csv', None)
    232232
    233233The result means: four entries were processed and no warnings
    234 occured. Let's check:
     234occured. Furthermore we get filepath to a CSV file with successfully
     235processed entries and a filepath to a CSV file with erraneous entries.
     236As everything went well, the latter is ``None``. Let's check:
    235237
    236238    >>> sorted(stoneville.keys())
     
    278280    ...                   ['name', 'dinoports', 'owner', 'taxpayer'],
    279281    ...                    mode='create', user='Bob', logger=logger)
    280     (4, 4)
     282    (4, 4, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv')
     283
     284This time we also get a path to a .pending file.
    281285
    282286The log file will tell us this in more detail:
     
    291295    Bob: Mode: create
    292296    Bob: User: Bob
    293     Bob: Failed datasets: newcomers.create.pending.csv
     297    Bob: Failed datasets: newcomers.pending.csv
    294298    Bob: Processing time: ... s (... s/item)
    295299    Bob: Processed: 4 lines (0 successful/ 4 failed)
     
    299303process and an additional column with error messages:
    300304
    301     >>> print open('newcomers.create.pending.csv').read()
     305    >>> print open('newcomers.pending.csv').read()
    302306    owner,name,taxpayer,dinoports,--ERRORS--
    303307    Barney,Barneys Home,1,2,This object already exists. Skipping.
     
    322326    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    323327    ...                    mode='update', user='Bob')
    324     (4, 0)
     328    (4, 0, '...', None)
    325329
    326330Now we want to tell, that Wilma got an extra port for her second dino:
     
    339343    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    340344    ...                    mode='update', user='Bob')
    341     (1, 0)
     345    (1, 0, '...', None)
    342346
    343347    >>> wilma = stoneville['Wilmas Asylum']
     
    356360    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    357361    ...                    mode='update', user='Bob')
    358     (1, 1)
     362    (1, 1, '/.../newcomers.finished.csv', '/.../newcomers.pending.csv')
    359363   
    360364Also invalid values will be spotted:
     
    367371    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    368372    ...                    mode='update', user='Bob')
    369     (1, 1)
     373    (1, 1, '...', '...')
    370374
    371375We can also update only some cols, leaving some out. We skip the
     
    379383    >>> processor.doImport('newcomers.csv', ['name', 'owner'],
    380384    ...                    mode='update', user='Bob')
    381     (1, 0)
     385    (1, 0, '...', None)
    382386
    383387    >>> wilma.owner
     
    410414    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    411415    ...                    mode='update', user='Bob')
    412     (1, 0)
     416    (1, 0, '...', None)
    413417
    414418    >>> wilma.dinoports is None
     
    424428    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    425429    ...                    mode='update', user='Bob')
    426     (1, 0)
     430    (1, 0, '...', None)
    427431
    428432    >>> wilma.dinoports is None
     
    442446    >>> processor.doImport('newcomers.csv', ['name', 'dinoports', 'owner'],
    443447    ...                    mode='remove', user='Bob')
    444     (1, 0)
     448    (1, 0, '...', None)
    445449
    446450    >>> sorted(stoneville.keys())
     
    454458    >>> import os
    455459    >>> os.unlink('newcomers.csv')
    456     >>> os.unlink('newcomers.create.pending.csv')
     460    >>> os.unlink('newcomers.finished.csv')
    457461    >>> os.unlink('stoneville.log')
Note: See TracChangeset for help on using the changeset viewer.