Changeset 7905


Ignore:
Timestamp:
18 Mar 2012, 14:23:02 (13 years ago)
Author:
uli
Message:

Reflect what we really expect from applicantscontainer CSV export.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_export.py

    r7903 r7905  
    44import tempfile
    55import unittest
    6 from zope.component import queryUtility
     6from zope.component import queryUtility, getUtilitiesFor
    77from zope.interface.verify import verifyObject, verifyClass
    88from waeup.kofa.interfaces import ICSVExporter
     
    1010from waeup.kofa.applicants import ApplicantsContainer
    1111from waeup.kofa.applicants.export import ApplicantsContainerExporter
     12from waeup.kofa.applicants.interfaces import (
     13    IApplicantsContainerProvider, AppCatSource)
    1214
    1315class ApplicantsContainersExporterTest(unittest.TestCase):
     
    3739        return
    3840
     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
    3960    def test_export(self):
    4061        # we can export a set of applicants containers (w/o applicants)
    4162        container = ApplicantsContainer()
    42         container.code = u'dp2012'
    43         container.startdate = datetime.date(2012, 1, 1)
     63        container = self.setup_container(container)
    4464        exporter = ApplicantsContainerExporter()
    4565        exporter.export([container], self.outfile)
     
    4969            'code,title,prefix,entry_level,year,provider,application_category,'
    5070            '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'
    5276            )
    5377        return
Note: See TracChangeset for help on using the changeset viewer.