Ignore:
Timestamp:
28 Jun 2018, 08:24:37 (7 years ago)
Author:
Henrik Bettermann
Message:

Extend tests.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/sample_studylevel_data.csv

    r9296 r15066  
    661,,2008,A,111
    771,,2008,A,nonsense
     81,,2008,A,<IGNORE>
    894,,2008,A,200
    9105,,2008,A,200
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r14901 r15066  
    775775        num, num_warns, fin_file, fail_file = self.processor.doImport(
    776776            self.csv_file, STUDYLEVEL_HEADER_FIELDS,'create')
    777         self.assertEqual(num_warns,2)
     777        self.assertEqual(num_warns,3)
    778778        assert self.processor.entryExists(
    779779            dict(reg_number='1', level='100'), self.app) is True
     
    784784        self.assertEqual(studylevel.level_verdict, '0')
    785785        self.assertEqual(studylevel.level, 100)
    786         shutil.rmtree(os.path.dirname(fin_file))
    787 
    788786        logcontent = open(self.logfile).read()
    789787        # Logging message from updateEntry,
     
    793791            'level=100, level_verdict=C, level_session=2009'
    794792            in logcontent)
     793        content = open(fail_file).read()
     794        self.assertEqual(
     795            content,
     796            'reg_number,level_verdict,level_session,matric_number,level,'
     797            '--ERRORS--\r\n'
     798            '1,A,2008,<IGNORE>,111,level: Invalid value\r\n'
     799            '1,A,2008,<IGNORE>,nonsense,level: Invalid value\r\n'
     800            '1,A,2008,<IGNORE>,<IGNORE>,level: Invalid value\r\n'
     801            )
     802        shutil.rmtree(os.path.dirname(fin_file))
    795803
    796804    def test_import_update(self):
     
    803811        num, num_warns, fin_file, fail_file = self.processor.doImport(
    804812            self.csv_file, STUDYLEVEL_HEADER_FIELDS,'update')
    805         self.assertEqual(num_warns,2)
     813        self.assertEqual(num_warns,3)
    806814        studylevel = self.processor.getEntry(
    807815            dict(reg_number='1', level='100'), self.app)
    808816        self.assertEqual(studylevel.level, 100)
     817        content = open(fail_file).read()
     818        self.assertEqual(
     819            content,
     820            'reg_number,level_verdict,level_session,matric_number,level,'
     821            '--ERRORS--\r\n'
     822            '1,A,2008,<IGNORE>,111,level: Invalid value\r\n'
     823            '1,A,2008,<IGNORE>,nonsense,level: Invalid value\r\n'
     824            '1,A,2008,<IGNORE>,<IGNORE>,Cannot update: no such entry\r\n'
     825            )
    809826        shutil.rmtree(os.path.dirname(fin_file))
    810827
     
    820837        assert self.processor.entryExists(
    821838            dict(reg_number='1', level='100'), self.app) is False
    822         self.assertEqual(num_warns,2)
     839        self.assertEqual(num_warns,3)
    823840
    824841        shutil.rmtree(os.path.dirname(fin_file))
Note: See TracChangeset for help on using the changeset viewer.