Ignore:
Timestamp:
23 May 2015, 06:54:24 (10 years ago)
Author:
Henrik Bettermann
Message:

Be more careful when checking conversion. Take ignore marker into consideration.

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_payment_data.csv

    r12623 r12996  
    44,paid,schoolfee,p1266236341955,3,2009,19500,BTECHBDT,19500,0615,00,2010/02/15 13:19:01#,online,1
    55,paid,schoolfee,ABC-11-1234567890,3,2011,19500,BTECHBDT,19500.6,,SC,2010/02/15 13:19:01#,sc,1
     6,paid,schoolfee,<IGNORE>,3,2012,20500,BTECHBDT,20500,0615,00,2020/02/15 13:19:01#,online,1
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py

    r12981 r12996  
    10641064    def test_checkConversion(self):
    10651065        errs, inv_errs, conv_dict = self.processor.checkConversion(
     1066            dict(p_id='<IGNORE>'), mode='create')
     1067        self.assertEqual(len(errs),0)
     1068        errs, inv_errs, conv_dict = self.processor.checkConversion(
     1069            dict(p_id='<IGNORE>'), mode='update')
     1070        self.assertEqual(len(errs),1)
     1071        self.assertEqual(errs[0], ('p_id', u'missing'))
     1072        errs, inv_errs, conv_dict = self.processor.checkConversion(
    10661073            dict(p_id='3816951266236341955'))
    10671074        self.assertEqual(len(errs),0)
     
    10751082            dict(p_id='nonsense'))
    10761083        self.assertEqual(len(errs),1)
     1084        self.assertEqual(errs[0], ('p_id', u'invalid format'))
    10771085        timestamp = ("%d" % int(time()*10000))[1:]
    10781086        p_id = "p%s" % timestamp
     
    11421150        # We perform the same import twice,
    11431151        # the second time in update mode. The number
    1144         # of warnings must be the same.
     1152        # of warnings increases becaus one p_id is missing.
    11451153        num, num_warns, fin_file, fail_file = self.processor.doImport(
    11461154            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
     
    11481156        num, num_warns, fin_file, fail_file = self.processor.doImport(
    11491157            self.csv_file, PAYMENT_HEADER_FIELDS,'update')
    1150         self.assertEqual(num_warns,0)
    1151         shutil.rmtree(os.path.dirname(fin_file))
     1158        self.assertEqual(num_warns,1)
     1159        content = open(fail_file).read()
     1160        shutil.rmtree(os.path.dirname(fin_file))
     1161        self.assertTrue('p_id: missing' in content)
    11521162
    11531163    def test_import_remove(self):
    11541164        # We perform the same import twice,
    11551165        # the second time in remove mode. The number
    1156         # of warnings must be the same.
     1166        # of warnings increases becaus one p_id is missing.
    11571167        num, num_warns, fin_file, fail_file = self.processor.doImport(
    11581168            self.csv_file, PAYMENT_HEADER_FIELDS,'create')
     
    11601170        num, num_warns, fin_file, fail_file = self.processor.doImport(
    11611171            self.csv_file, PAYMENT_HEADER_FIELDS,'remove')
    1162         self.assertEqual(num_warns,0)
     1172        self.assertEqual(num_warns,1)
     1173        content = open(fail_file).read()
     1174        self.assertTrue('p_id: missing' in content)
    11631175        shutil.rmtree(os.path.dirname(fin_file))
    11641176        logcontent = open(self.logfile).read()
     
    11671179            in logcontent)
    11681180
    1169     def test_import_wo_pid(self):
     1181    def test_import_same_payment_exists(self):
    11701182        num, num_warns, fin_file, fail_file = self.processor.doImport(
    11711183            self.csv_file2, PAYMENT_CREATE_HEADER_FIELDS,'create')
Note: See TracChangeset for help on using the changeset viewer.