Ignore:
Timestamp:
21 Sep 2012, 08:19:35 (12 years ago)
Author:
uli
Message:

Rollback r9209. Looks like multiple merges from trunk confuse svn when merging back into trunk.

Location:
main/waeup.kofa/branches/uli-zc-async
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-zc-async

  • main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_browser.py

    r9209 r9211  
    2323import tempfile
    2424import grok
    25 from datetime import datetime
    2625from StringIO import StringIO
    2726from datetime import datetime, date, timedelta
     
    4746PH_LEN = 2059  # Length of placeholder file
    4847
    49 session_1 = datetime.now().year - 2
    50 container_name_1 = u'app%s' % session_1
    51 session_2 = datetime.now().year - 1
    52 container_name_2 = u'app%s' % session_2
    53 
    5448class ApplicantsFullSetup(FunctionalTestCase):
    5549    # A test case that only contains a setup and teardown
     
    8680        self.manage_root_path = self.root_path + '/@@manage'
    8781        self.add_container_path = self.root_path + '/@@add'
    88         self.container_path = 'http://localhost/app/applicants/%s' % container_name_1
     82        self.container_path = 'http://localhost/app/applicants/app2009'
    8983        self.manage_container_path = self.container_path + '/@@manage'
    9084
    9185        # Add an applicants container
    9286        applicantscontainer = ApplicantsContainer()
    93         applicantscontainer.code = container_name_1
     87        applicantscontainer.code = u'app2009'
    9488        applicantscontainer.prefix = 'app'
    95         applicantscontainer.year = session_1
    96         applicantscontainer.title = u'This is the %s container' % container_name_1
     89        applicantscontainer.year = 2009
     90        applicantscontainer.title = u'This is the app2009 container'
    9791        applicantscontainer.application_category = 'basic'
    9892        applicantscontainer.mode = 'create'
     
    10195        applicantscontainer.startdate = datetime.now(pytz.utc) - delta
    10296        applicantscontainer.enddate = datetime.now(pytz.utc) + delta
    103         self.app['applicants'][container_name_1] = applicantscontainer
    104         self.applicantscontainer = self.app['applicants'][container_name_1]
     97        self.app['applicants']['app2009'] = applicantscontainer
     98        self.applicantscontainer = self.app['applicants']['app2009']
    10599
    106100        # Populate university
     
    141135        self.applicant.reg_number = u'1234'
    142136        self.applicant.course1 = certificate
    143         app['applicants'][container_name_1].addApplicant(self.applicant)
     137        app['applicants']['app2009'].addApplicant(self.applicant)
    144138        IUserAccount(
    145             self.app['applicants'][container_name_1][
     139            self.app['applicants']['app2009'][
    146140            self.applicant.application_number]).setPassword('apwd')
    147141        self.manage_path = 'http://localhost/app/applicants/%s/%s/%s' % (
    148             container_name_1, self.applicant.application_number, 'manage')
     142            'app2009', self.applicant.application_number, 'manage')
    149143        self.edit_path = 'http://localhost/app/applicants/%s/%s/%s' % (
    150             container_name_1, self.applicant.application_number, 'edit')
     144            'app2009', self.applicant.application_number, 'edit')
    151145        self.view_path = 'http://localhost/app/applicants/%s/%s' % (
    152             container_name_1, self.applicant.application_number)
     146            'app2009', self.applicant.application_number)
    153147
    154148    def login(self):
     
    309303            'There were errors' in self.browser.contents)
    310304        self.browser.getControl(name="form.prefix").value = ['app']
    311         self.browser.getControl(name="form.year").value = [str(session_2)]
     305        self.browser.getControl(name="form.year").value = ['2010']
    312306        self.browser.getControl(name="form.mode").value = ['create']
    313307        self.browser.getControl(
     
    323317        self.browser.open(self.add_container_path)
    324318        self.browser.getControl(name="form.prefix").value = ['app']
    325         self.browser.getControl(name="form.year").value = [str(session_2)]
     319        self.browser.getControl(name="form.year").value = ['2010']
    326320        self.browser.getControl(name="form.mode").value = ['create']
    327321        self.browser.getControl(
     
    332326        self.browser.open(self.manage_root_path)
    333327        ctrl = self.browser.getControl(name='val_id')
    334         ctrl.getControl(value=container_name_2).selected = True
     328        ctrl.getControl(value='app2010').selected = True
    335329        self.browser.getControl("Remove selected", index=0).click()
    336330        self.assertTrue('Successfully removed:' in self.browser.contents)
    337331        self.browser.open(self.add_container_path)
    338332        self.browser.getControl(name="form.prefix").value = ['app']
    339         self.browser.getControl(name="form.year").value = [str(session_2)]
     333        self.browser.getControl(name="form.year").value = ['2010']
    340334        self.browser.getControl(name="form.mode").value = ['create']
    341335        #self.browser.getControl(name="form.ac_prefix").value = ['APP']
     
    343337            name="form.application_category").value = ['basic']
    344338        self.browser.getControl("Add applicants container").click()
    345         del self.app['applicants'][container_name_2]
     339        del self.app['applicants']['app2010']
    346340        ctrl = self.browser.getControl(name='val_id')
    347         ctrl.getControl(value=container_name_2).selected = True
     341        ctrl.getControl(value='app2010').selected = True
    348342        self.browser.getControl("Remove selected", index=0).click()
    349343        self.assertMatches('...Could not delete...', self.browser.contents)
     
    471465        self.browser.open(self.slip_path)
    472466        self.assertTrue(
    473             'Please pay and submit before trying to download the application slip.'
     467            'Please pay before trying to download the application slip.'
    474468            in self.browser.contents)
    475469        # If applicant is in correct state the pdf slip can be opened.
    476         IWorkflowState(self.applicant).setState('submitted')
     470        IWorkflowState(self.applicant).setState('paid')
    477471        self.browser.open(self.manage_path)
    478472        self.browser.getLink("Download application slip").click()
     
    499493            self.browser.headers['content-length'], str(PH_LEN))
    500494
    501     def test_applicant_login(self):
    502         self.applicant.suspended = True
    503         self.login()
    504         self.assertTrue(
    505             'You entered invalid credentials.' in self.browser.contents)
    506         self.applicant.suspended = False
    507         self.browser.getControl("Login").click()
    508         self.assertTrue(
    509             'You logged in.' in self.browser.contents)
    510 
    511495    def test_applicant_access(self):
    512496        # Applicants can edit their record
    513497        self.browser.open(self.login_path)
    514498        self.login()
    515         self.assertTrue(
    516             'You logged in.' in self.browser.contents)
    517499        self.browser.open(self.edit_path)
    518500        self.assertTrue(self.browser.url != self.login_path)
     
    717699            in self.browser.contents)
    718700        configuration = SessionConfiguration()
    719         configuration.academic_session = session_1
     701        configuration.academic_session = 2009
    720702        configuration.application_fee = 200.0
    721703        self.app['configuration'].addSessionConfiguration(configuration)
     
    745727        payment_id = self.applicant.keys()[0]
    746728        payment = self.applicant[payment_id]
    747         self.assertEqual(payment.p_item,'This is the %s container' % container_name_1)
    748         self.assertEqual(payment.p_session, session_1)
     729        self.assertEqual(payment.p_item,'This is the app2009 container')
     730        self.assertEqual(payment.p_session,2009)
    749731        self.assertEqual(payment.p_category,'application')
    750732        self.assertEqual(payment.amount_auth,200.0)
     
    839821        self.browser.getControl("Final Submit").click()
    840822        self.assertTrue(
    841             'Application submitted' in self.browser.contents)
     823            '... submitted ...' in self.browser.contents)
    842824        # ... or allow submission after deadline.
    843825        IWorkflowState(self.applicant).setState('paid')
     
    848830        self.browser.getControl("Final Submit").click()
    849831        self.assertTrue(
    850             'Application submitted' in self.browser.contents)
     832            '... submitted ...' in self.browser.contents)
    851833        self.browser.goBack(count=1)
    852834        self.browser.getControl("Save").click()
     
    935917        self.browser.getControl(name="form.phone.area").value = '555'
    936918        self.browser.getControl(name="form.phone.ext").value = '6666666'
    937         self.browser.getControl("Send login credentials").click()
     919        self.browser.getControl("Get login credentials").click()
    938920        self.assertEqual(self.browser.url,
    939921            self.container_path + '/registration_complete?email=xx%40yy.zz')
     
    962944        self.browser.getControl(name="form.reg_number").value = 'anynumber'
    963945        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    964         self.browser.getControl("Send login credentials").click()
     946        self.browser.getControl("Get login credentials").click()
    965947        self.assertTrue('No application record found.'
    966948            in self.browser.contents)
     
    972954        self.browser.getControl(name="form.reg_number").value = '1234'
    973955        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    974         self.browser.getControl("Send login credentials").click()
     956        self.browser.getControl("Get login credentials").click()
    975957        self.assertTrue('An error occurred.' in self.browser.contents)
    976958        # Let's set this attribute manually
     
    981963        self.browser.getControl(name="form.reg_number").value = '1234'
    982964        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    983         self.browser.getControl("Send login credentials").click()
     965        self.browser.getControl("Get login credentials").click()
    984966        # Anonymous is not informed that firstname verification failed.
    985967        # It seems that the record doesn't exist.
     
    991973        self.browser.getControl(name="form.firstname").value = 'John'
    992974        self.browser.getControl(name="form.reg_number").value = '1234'
    993         self.browser.getControl("Send login credentials").click()
     975        self.browser.getControl("Get login credentials").click()
    994976        self.assertTrue('Your password has already been set and used.'
    995977            in self.browser.contents)
    996978        #IUserAccount(
    997         #    self.app['applicants'][container_name_1][
     979        #    self.app['applicants']['app2009'][
    998980        #    self.applicant.application_number]).context.password = None
    999981        # Even without unsetting the password we can re-register if state
     
    1005987        self.browser.getControl(name="form.reg_number").value = '1234'
    1006988        self.browser.getControl(name="form.email").value = 'new@yy.zz'
    1007         self.browser.getControl("Send login credentials").click()
     989        self.browser.getControl("Get login credentials").click()
    1008990        # Yeah, we succeded ...
    1009991        self.assertTrue('Your registration was successful.'
     
    10211003        self.browser.getControl(name="form.identifier").value = '1234'
    10221004        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
    1023         self.browser.getControl("Send login credentials").click()
     1005        self.browser.getControl("Get login credentials").click()
    10241006        self.assertTrue('No record found' in self.browser.contents)
    10251007        self.applicant.email = 'aa@aa.ng'
     
    10291011        self.browser.getControl(name="form.identifier").value = '1234'
    10301012        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
    1031         self.browser.getControl("Send login credentials").click()
     1013        self.browser.getControl("Get login credentials").click()
    10321014        self.assertTrue(
    10331015            'An email with your user name and password has been sent'
Note: See TracChangeset for help on using the changeset viewer.