Ignore:
Timestamp:
13 Jan 2014, 08:55:58 (11 years ago)
Author:
Henrik Bettermann
Message:

Fix tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_browser.py

    r10379 r10899  
    4343from kofacustom.nigeria.applicants.batching import NigeriaApplicantProcessor
    4444
     45session_1 = datetime.datetime.now().year - 2
     46app_container_name = u'app%s' % session_1
     47pgft_container_name = u'pgft%s' % session_1
    4548
    4649class ApplicantUITest(FunctionalTestCase):
     
    6871        # Add an two different applicants containers
    6972        self.pgcontainer = ApplicantsContainer()
    70         self.pgcontainer.code = u'pgft2011'
     73        self.pgcontainer.code = pgft_container_name
    7174        self.pgcontainer.prefix = u'pgft'
    7275        self.pgcontainer.application_category = u'pg_ft'
    73         self.pgcontainer.year = 2011
     76        self.pgcontainer.year = session_1
    7477        self.pgcontainer.application_fee = 300.0
    75         self.pgcontainer.title = u'This is the pgft2011 container'
    76         self.app['applicants']['pgft2011'] = self.pgcontainer
     78        self.pgcontainer.title = u'This is the %s container' % pgft_container_name
     79        self.app['applicants'][pgft_container_name] = self.pgcontainer
    7780        self.ugcontainer = ApplicantsContainer()
    78         self.ugcontainer.code = u'putme2011'
    79         self.ugcontainer.prefix = u'putme'
     81        self.ugcontainer.code = app_container_name
     82        self.ugcontainer.prefix = u'app'
    8083        self.ugcontainer.application_category = u'basic'
    81         self.ugcontainer.year = 2011
     84        self.ugcontainer.year = session_1
    8285        self.ugcontainer.application_fee = 200.0
    83         self.ugcontainer.title = u'This is the app2011 container'
    84         self.app['applicants']['app2011'] = self.ugcontainer
     86        self.ugcontainer.title = u'This is the %s container' % app_container_name
     87        self.app['applicants'][app_container_name] = self.ugcontainer
    8588
    8689        self.ugcontainer.mode = 'update'
     
    113116        pgapplicant.firstname = u'Anna'
    114117        pgapplicant.lastname = u'Post'
    115         self.app['applicants']['pgft2011'].addApplicant(pgapplicant)
     118        self.app['applicants'][pgft_container_name].addApplicant(pgapplicant)
    116119        self.pgapplication_number = pgapplicant.application_number
    117         self.pgapplicant = self.app['applicants']['pgft2011'][
     120        self.pgapplicant = self.app['applicants'][pgft_container_name][
    118121            self.pgapplication_number]
    119122
     
    121124        ugapplicant.firstname = u'Klaus'
    122125        ugapplicant.lastname = u'Under'
    123         self.app['applicants']['app2011'].addApplicant(ugapplicant)
     126        self.app['applicants'][app_container_name].addApplicant(ugapplicant)
    124127        self.ugapplication_number = ugapplicant.application_number
    125         self.ugapplicant = self.app['applicants']['app2011'][
     128        self.ugapplicant = self.app['applicants'][app_container_name][
    126129            self.ugapplication_number]
    127         self.pgapplicant_path = ('http://localhost/app/applicants/pgft2011/%s'
    128             % self.pgapplication_number)
    129         self.ugapplicant_path = ('http://localhost/app/applicants/app2011/%s'
    130             % self.ugapplication_number)
     130        self.pgapplicant_path = ('http://localhost/app/applicants/%s/%s'
     131            % (pgft_container_name, self.pgapplication_number))
     132        self.ugapplicant_path = ('http://localhost/app/applicants/%s/%s'
     133            % (app_container_name, self.ugapplication_number))
    131134
    132135        self.browser = Browser()
    133136        self.browser.handleErrors = False
     137
     138        configuration = SessionConfiguration()
     139        configuration.academic_session = session_1
     140        configuration.application_fee = 200.0
     141        self.app['configuration'].addSessionConfiguration(configuration)
    134142
    135143    def tearDown(self):
     
    213221        payment_id = self.ugapplicant.keys()[0]
    214222        payment = self.ugapplicant[payment_id]
    215         self.assertEqual(payment.p_item,'This is the app2011 container')
    216         self.assertEqual(payment.p_session,2011)
     223        self.assertEqual(payment.p_item,'This is the %s container' % app_container_name)
     224        self.assertEqual(payment.p_session,session_1)
    217225        self.assertEqual(payment.p_category,'application')
    218226        self.assertEqual(payment.amount_auth, 200.0)
     
    235243        payment_id = self.pgapplicant.keys()[0]
    236244        payment = self.pgapplicant[payment_id]
    237         self.assertEqual(payment.p_item,'This is the pgft2011 container')
    238         self.assertEqual(payment.p_session,2011)
     245        self.assertEqual(payment.p_item,'This is the %s container' % pgft_container_name)
     246        self.assertEqual(payment.p_session,session_1)
    239247        self.assertEqual(payment.p_category,'application')
    240248        self.assertEqual(payment.amount_auth, 300.0)
     
    265273        self.ugapplicant.reg_number = u'1234'
    266274        notify(grok.ObjectModifiedEvent(self.ugapplicant))
    267         self.browser.open('http://localhost/app/applicants/app2011/')
     275        self.browser.open('http://localhost/app/applicants/%s/' % app_container_name)
    268276        self.browser.getLink("Register for application").click()
    269277        # Fill the edit form with suitable values
     
    291299        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    292300        manage_path = 'http://localhost/app/applicants/%s/%s/%s' % (
    293             'app2011', self.ugapplicant.application_number, 'manage')
     301            app_container_name, self.ugapplicant.application_number, 'manage')
    294302        self.browser.open(manage_path)
    295303        self.fill_correct_values()
     
    362370            'password,phone,pp_school,presently_inst,reg_number,'
    363371            'result_uploaded,screening_date,screening_score,'
    364             'screening_venue,sex,state,student_id,suspended,container_code\r\n'
     372            'screening_venue,sex,special_application,'
     373            'state,student_id,suspended,container_code\r\n'
    365374            ',dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,'
    366375            'Anna M. Tester,anna@sample.com,,,,,,,,,,,Anna,'
     
    368377            ',,,,,,,,,Tester,,0,M.,NG,"Some notice\nin lines.",,,'
    369378            'any password,+234-123-12345#,,,123456,,'
    370             '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,initialized,,'
     379            '"Saturday, 16th June 2012 2:00:00 PM",98,Exam Room,f,,initialized,,'
    371380            '0,dp2011\r\n')
    372381        # We can import the same file if we ignore some columns.
     
    387396            'reg_number','result_uploaded',
    388397            'screening_date','screening_score','screening_venue','sex',
     398            'special_application',
    389399            'state','student_id','suspended','container_code'],
    390400            mode='create')
     
    411421            'nysc_year','password','phone','pp_school','presently_inst',
    412422            'reg_number','result_uploaded','screening_date','screening_score',
    413             'screening_venue','sex',
     423            'screening_venue','sex','special_application',
    414424            'state','student_id','suspended','ignore_container_code'],
    415425            mode='update')
Note: See TracChangeset for help on using the changeset viewer.