Changeset 6251 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 30 May 2011, 21:57:00 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/batching.py
r6250 r6251 26 26 from waeup.sirp.interfaces import IBatchProcessor 27 27 from waeup.sirp.utils.batching import BatchProcessor 28 from waeup.sirp.applicants. jambtables.interfaces import IApplicantPDEImportData28 from waeup.sirp.applicants.interfaces import IApplicantsContainer 29 29 30 class JAMBDataImporter(BatchProcessor):31 """An importer for applicants .30 class ApplicantsContainerImporter(BatchProcessor): 31 """An importer for applicants containers. 32 32 """ 33 33 grok.implements(IBatchProcessor) 34 34 grok.provides(IBatchProcessor) 35 35 grok.context(Interface) 36 util_name = 'applica tionimporter'36 util_name = 'applicants container importer' 37 37 grok.name(util_name) 38 38 39 name = u' JAMB DataImporter'39 name = u'Applicants Container Importer' 40 40 mode = u'create' 41 iface = IApplicant PDEImportData41 iface = IApplicantsContainer 42 42 43 location_fields = [' reg_no',]44 factory_name = 'waeup.Applicant '43 location_fields = ['code',] 44 factory_name = 'waeup.ApplicantContainer' 45 45 46 46 def parentsExist(self, row, site): 47 return ' jambdata' in site.keys()47 return 'applicants' in site.keys() 48 48 49 49 def entryExists(self, row, site): 50 return row[' reg_no'] in site['jambdata'].keys()50 return row['code'] in site['applicants'].keys() 51 51 52 52 def getParent(self, row, site): 53 return site[' jambdata']53 return site['applicants'] 54 54 55 55 def getEntry(self, row, site): … … 57 57 return None 58 58 parent = self.getParent(row, site) 59 return parent.get(row[' reg_no'])59 return parent.get(row['code']) 60 60 61 61 def addEntry(self, obj, row, site): 62 62 parent = self.getParent(row, site) 63 reg_no = row['reg_no'] 64 parent[reg_no] = obj 63 parent[row['code']] = obj 65 64 return 66 65 67 66 def delEntry(self, row, site): 68 67 parent = self.getParent(row, site) 69 del parent[row[' reg_no']]68 del parent[row['code']] 70 69 return -
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_batching.py
r6250 r6251 20 20 ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 21 ## 22 """Unit tests for the JAMB data importer.22 """Unit tests for applicants-related data importers. 23 23 """ 24 25 24 import grok 26 25 import os … … 28 27 import tempfile 29 28 import unittest 29 from zope.app.testing.functional import FunctionalTestCase 30 30 from zope.component.hooks import setSite, clearSite 31 from zope.interface import verify 31 from zope.interface.verify import verifyClass, verifyObject 32 33 from waeup.sirp.app import University 34 from waeup.sirp.applicants.batching import ApplicantsContainerImporter 35 from waeup.sirp.applicants.interfaces import IApplicantsContainer 36 from waeup.sirp.interfaces import DuplicationError 37 from waeup.sirp.testing import FunctionalLayer, doctestsuite_for_module 32 38 from waeup.sirp.interfaces import IBatchProcessor 33 from waeup.sirp.applicants.jambtables import JAMBDataImporter 39 34 40 35 41 # Sample data we can use in tests... … … 47 53 return object() 48 54 49 class JAMBDataImporterTest(unittest.TestCase):55 class ApplicantsContainerImporterTest(unittest.TestCase): 50 56 51 57 def setUp(self): 52 self.importer = JAMBDataImporter()58 self.importer = ApplicantsContainerImporter() 53 59 self.site1 = dict( 54 60 jambdata = { … … 68 74 def test_interface(self): 69 75 """Make sure we fulfill the interface contracts.""" 70 assert verify.verifyObject(IBatchProcessor, self.importer) is True 71 assert verify.verifyClass(IBatchProcessor, JAMBDataImporter) is True 76 assert verifyObject(IBatchProcessor, self.importer) is True 77 assert verifyClass( 78 IBatchProcessor, ApplicantsContainerImporter) is True 72 79 73 80 def test_parentsExist(self): … … 120 127 suite = unittest.TestSuite() 121 128 for testcase in [ 122 JAMBDataImporterTest,129 ApplicantsContainerImporterTest, 123 130 ]: 124 131 suite.addTest(unittest.TestLoader().loadTestsFromTestCase(
Note: See TracChangeset for help on using the changeset viewer.