Changeset 6798 for main/waeup.sirp


Ignore:
Timestamp:
19 Sep 2011, 10:54:58 (13 years ago)
Author:
Henrik Bettermann
Message:

Split up functional tests a bit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6782 r6798  
    115115
    116116        # Populate university
    117         certificate = createObject('waeup.Certificate')
    118         certificate.code = 'CERT1'
    119         certificate.application_category = 'basic'
    120         certificate.start_level = 100
    121         certificate.end_level = 500
     117        self.certificate = createObject('waeup.Certificate')
     118        self.certificate.code = 'CERT1'
     119        self.certificate.application_category = 'basic'
     120        self.certificate.start_level = 100
     121        self.certificate.end_level = 500
    122122        self.app['faculties']['fac1'] = Faculty()
    123123        self.app['faculties']['fac1']['dep1'] = Department()
    124124        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    125             certificate)
     125            self.certificate)
    126126
    127127        # Put the prepopulated site into test ZODB and prepare test
     
    267267                           self.browser.contents)
    268268
     269        # Managers can browse all subobjects
     270        self.browser.open(self.student_path)
     271        self.browser.getLink("Payments").click()
     272        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     273        self.assertEqual(self.browser.url, self.payments_student_path)
     274        self.browser.open(self.student_path)
     275        self.browser.getLink("Accommodation").click()
     276        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     277        self.assertEqual(self.browser.url, self.accommodation_student_path)
     278        self.browser.open(self.student_path)
     279        self.browser.getLink("History").click()
     280        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     281        self.assertEqual(self.browser.url, self.history_student_path)
     282        self.assertMatches('...Student admitted by zope.mgr...',
     283                           self.browser.contents)
     284
     285    def test_manage_course_lists(self):
     286        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    269287        self.browser.open(self.student_path)
    270288        self.browser.getLink("Study Course").click()
     
    282300        self.browser.getControl(name="form.current_level").value = ['100']
    283301        self.browser.getControl("Save").click()
    284 
    285         # Managers can add a any sudy level (course list)
     302        # Managers can add a any study level (course list)
    286303        self.browser.getControl(name="addlevel").value = ['100']
    287304        self.browser.getControl("Add study level").click()
     
    289306                           self.browser.contents)
    290307
    291         # Managers can browse all subobjects
    292         self.browser.open(self.student_path)
    293         self.browser.getLink("Payments").click()
    294         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    295         self.assertEqual(self.browser.url, self.payments_student_path)
    296         self.browser.open(self.student_path)
    297         self.browser.getLink("Accommodation").click()
    298         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    299         self.assertEqual(self.browser.url, self.accommodation_student_path)
    300         self.browser.open(self.student_path)
    301         self.browser.getLink("History").click()
    302         self.assertEqual(self.browser.headers['Status'], '200 Ok')
    303         self.assertEqual(self.browser.url, self.history_student_path)
    304         self.assertMatches('...Student admitted by zope.mgr...',
    305                            self.browser.contents)
    306 
     308    def test_manage_workflow(self):
    307309        # Managers can pass through the whole workflow
     310        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    308311        student = self.app['students'][self.test_student_id]
    309312        self.browser.open(self.manage_student_path)
    310313        self.assertTrue(student.clearance_locked)
     314        self.browser.getControl(name="transition").value = ['admit']
     315        self.browser.getControl("Save").click()
     316        self.assertTrue(student.clearance_locked)
    311317        self.browser.getControl(name="transition").value = ['start_clearance']
    312318        self.browser.getControl("Save").click()
     
    321327        self.browser.getControl(name="transition").value = ['reset6']
    322328        self.browser.getControl("Save").click()
    323         # The pay_school_fee transition triggers some changes
     329        # The pay_school_fee transition triggers some changes of previously
     330        # set attributes
     331        student['studycourse'].certificate = self.certificate
     332        student['studycourse'].current_session = 2004
     333        student['studycourse'].current_verdict = 'A'
     334        student['studycourse'].current_level = 100
    324335        self.browser.getControl(name="transition").value = ['pay_school_fee']
    325336        self.browser.getControl("Save").click()
    326         self.assertEqual(student['studycourse'].current_session, 2005) # was 2004
    327         self.assertEqual(student['studycourse'].current_level, 200) # was 100
    328         self.assertEqual(student['studycourse'].current_verdict, '') # was 'A'
    329         self.assertEqual(student['studycourse'].previous_verdict, 'A') # was empty
     337        self.assertEqual(student['studycourse'].current_session, 2005)
     338        self.assertEqual(student['studycourse'].current_level, 200)
     339        self.assertEqual(student['studycourse'].current_verdict, '')
     340        self.assertEqual(student['studycourse'].previous_verdict, 'A')
    330341        return
    331342
Note: See TracChangeset for help on using the changeset viewer.