Changeset 4330


Ignore:
Timestamp:
21 Jun 2009, 01:07:34 (16 years ago)
Author:
uli
Message:

Add tests for importing CSV certificate files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/browser.txt

    r4278 r4330  
    232232  >>> browser.getControl(name='SUBMIT').click()
    233233
     234We create and upload also a CSV file containing certificates:
     235
     236  >>> open('certificates.csv', 'wb').write(
     237  ... """code,title,faculty_code,department_code,category,study_mode,end_level,m_prefix,max_pass,start_level,application_category
     238  ... LBA,BACHELOR OF LITERATURE,FA,LIT,UG,ug_ft,500,LIT,30,100,basic
     239  ... LMA,MASTER OF LITERATURE,FA,LIT,UG,ug_pt,500,LIT,30,100,cest
     240  ... DME,DIPLOMA OF MATH,FS,MAT,DP,dp_ft,200,DME,30,100,cest
     241  ... """)
     242
     243  >>> browser.open('http://localhost/myuniversity/datacenter/upload')
     244  >>> browser.getControl(name='uploadfile:file').add_file(
     245  ...   cStringIO.StringIO(open('certificates.csv', 'rb').read()),
     246  ...   'text/plain', 'mycertificates.csv')
     247  >>> browser.getControl(name='SUBMIT').click()
    234248
    235249
     
    303317  ...
    304318
     319We can also import the certificate data:
     320
     321  >>> browser.open('http://localhost/myuniversity/datacenter')
     322  >>> browser.getLink('Import CSV data').click()
     323  >>> browser.getControl('Import!', index=3).click()
     324
     325  >>> print browser.contents
     326  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     327  ...Successfully imported: mycertificates.csv...
     328  ...
     329
    305330
    306331Clean up:
Note: See TracChangeset for help on using the changeset viewer.