Changeset 13873 for main/waeup.kofa/trunk/src
- Timestamp:
- 4 Jun 2016, 04:43:01 (8 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/batching.py
r13872 r13873 20 20 import unicodecsv as csv # XXX: csv ops should move to dedicated module. 21 21 import grok 22 from time import time 22 23 from zope.schema import getFields 23 24 from zope.interface import Interface … … 341 342 """The Applicant Online Payment Processor imports applicant payment tickets. 342 343 The tickets are located in the applicant container. 343 The only additional locator is `p_id`, the object id.344 344 345 345 The `checkConversion` method checks the format of the payment identifier. … … 365 365 def available_fields(self): 366 366 af = sorted(list(set( 367 self.location_fields + getFields(self.iface).keys())) + ['p_id',])367 self.location_fields + getFields(self.iface).keys()))) 368 368 af.remove('display_item') 369 369 return af -
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_batching.py
r13872 r13873 25 25 import unittest 26 26 import grok 27 from time import time 27 28 from hurry.workflow.interfaces import IWorkflowState 28 29 from zope.component.hooks import setSite, clearSite … … 498 499 dict(applicant_id=self.applicant2.applicant_id, p_id='p456'), self.app) 499 500 501 def test_checkConversion(self): 502 errs, inv_errs, conv_dict = self.processor.checkConversion( 503 dict(p_id='<IGNORE>'), mode='create') 504 self.assertEqual(len(errs),0) 505 errs, inv_errs, conv_dict = self.processor.checkConversion( 506 dict(p_id='<IGNORE>'), mode='update') 507 self.assertEqual(len(errs),1) 508 self.assertEqual(errs[0], ('p_id', u'missing')) 509 errs, inv_errs, conv_dict = self.processor.checkConversion( 510 dict(p_id='p1266236341955')) 511 self.assertEqual(len(errs),0) 512 errs, inv_errs, conv_dict = self.processor.checkConversion( 513 dict(p_id='nonsense')) 514 self.assertEqual(len(errs),1) 515 self.assertEqual(errs[0], ('p_id', u'invalid length')) 516 timestamp = ("%d" % int(time()*10000))[1:] 517 p_id = "p%s" % timestamp 518 errs, inv_errs, conv_dict = self.processor.checkConversion( 519 dict(p_id=p_id)) 520 self.assertEqual(len(errs),0) 521 dup_payment = createObject(u'waeup.ApplicantOnlinePayment') 522 dup_payment.p_id = 'p1266236341955' 523 self.applicant2[dup_payment.p_id] = dup_payment 524 errs, inv_errs, conv_dict = self.processor.checkConversion( 525 dict(p_id='p1266236341955'), mode='create') 526 self.assertEqual(len(errs),1) 527 self.assertEqual(errs[0], ('p_id', u'p_id exists in dp2011_1234 ')) 528 500 529 def test_import(self): 501 530 num, num_warns, fin_file, fail_file = self.processor.doImport(
Note: See TracChangeset for help on using the changeset viewer.