Changeset 7905 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 18 Mar 2012, 14:23:02 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py
r7903 r7905 4 4 import tempfile 5 5 import unittest 6 from zope.component import queryUtility 6 from zope.component import queryUtility, getUtilitiesFor 7 7 from zope.interface.verify import verifyObject, verifyClass 8 8 from waeup.kofa.interfaces import ICSVExporter … … 10 10 from waeup.kofa.applicants import ApplicantsContainer 11 11 from waeup.kofa.applicants.export import ApplicantsContainerExporter 12 from waeup.kofa.applicants.interfaces import ( 13 IApplicantsContainerProvider, AppCatSource) 12 14 13 15 class ApplicantsContainersExporterTest(unittest.TestCase): … … 37 39 return 38 40 41 def setup_container(self, container): 42 # set all attributes of a container 43 container.code = u'dp2012' 44 container.title = u'General Studies 2012/13' 45 from waeup.kofa.applicants.interfaces import ( 46 ApplicationTypeSource, ApplicantContainerProviderSource,) 47 container.prefix = list(ApplicationTypeSource()(container))[0] 48 container.year = 2012 49 provider = [ 50 x for x in getUtilitiesFor(IApplicantsContainerProvider) 51 if x[0] == 'waeup.kofa.applicants.ApplicantsContainer'][0] 52 container.provider = provider 53 container.application_category = list(AppCatSource()(container))[0] 54 container.description = u'Some Description\nwith linebreak\n' 55 container.description += u'<<de>>man spriht deutsh' 56 container.startdate = datetime.date(2012, 1, 1) 57 container.enddate = datetime.date(2012, 1, 31) 58 return container 59 39 60 def test_export(self): 40 61 # we can export a set of applicants containers (w/o applicants) 41 62 container = ApplicantsContainer() 42 container.code = u'dp2012' 43 container.startdate = datetime.date(2012, 1, 1) 63 container = self.setup_container(container) 44 64 exporter = ApplicantsContainerExporter() 45 65 exporter.export([container], self.outfile) … … 49 69 'code,title,prefix,entry_level,year,provider,application_category,' 50 70 'description,startdate,enddate,strict_deadline\r\n' 51 'dp2012,-,,100,,,,"This text can been seen by anonymous users.\nHere we put mult-lingual information about the study courses provided, the application procedure and deadlines.\n>>de<<\nDieser Text kann von anonymen Benutzern gelesen werden.\nHier koennen mehrsprachige Informationen fuer Antragsteller hinterlegt werden.",2012-01-01,,1\r\n' 71 72 'dp2012,General Studies 2012/13,app,100,2012,' 73 'waeup.kofa.applicants.ApplicantsContainer,basic,' 74 '"Some Description\nwith linebreak\n<<de>>man spriht deutsh",' 75 '2012-01-01,2012-01-31,1\r\n' 52 76 ) 53 77 return
Note: See TracChangeset for help on using the changeset viewer.