Ignore:
Timestamp:
3 Jun 2012, 08:14:29 (13 years ago)
Author:
Henrik Bettermann
Message:

Add test for importing non-exsiting course1.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_faulty_applicant_data.csv

    r8291 r8609  
    11application_number,container_code,reg_number,firstname,lastname,date_of_birth,email,course1,sex,middlename,password
    22,dp2011,1001,Aaren,Pieri,01/02/1990,xx@yy.zz,CERT1,m,Claus,
     35678,dp2011,1005,Jim,Knopf,1990-01-06,xx@yy.zz,CERT2,m,,
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py

    r8353 r8609  
    316316
    317317    def test_import_faulty(self):
     318        num, num_warns, fin_file, fail_file = self.processor.doImport(
     319            self.csv_file_faulty, APPLICANT_HEADER_FIELDS)
    318320        # we cannot import data with faulty dates. A date is faulty
    319321        # when in format xx/yy/zzzz as we cannot say whether it is
    320322        # meant as dd/mm/yyyy or mm/dd/yyyy. We therefore require yyyy-mm-dd
    321         num, num_warns, fin_file, fail_file = self.processor.doImport(
    322             self.csv_file_faulty, APPLICANT_HEADER_FIELDS)
    323         if fail_file is not None:
    324             fail_contents = open(fail_file, 'rb').read()
    325             shutil.rmtree(os.path.dirname(fail_file))
    326         else:
    327             shutil.rmtree(os.path.dirname(fin_file))
    328323        for applicant in self.app['applicants']['dp2011'].values():
    329324            if applicant.date_of_birth == datetime.date(1990, 1, 2):
     
    331326                    'Wrong birthdate of imported applicant '
    332327                    '(1990-01-02, should be: 1990-02-01)')
     328        # CERT2 does not exist.
     329        fail_contents = open(fail_file, 'rb').read()
     330        shutil.rmtree(os.path.dirname(fail_file))
     331        self.assertTrue('course1: Invalid value' in fail_contents)
    333332        return
    334333
Note: See TracChangeset for help on using the changeset viewer.