Changeset 6763 for main/waeup.sirp/trunk


Ignore:
Timestamp:
14 Sep 2011, 07:14:50 (13 years ago)
Author:
Henrik Bettermann
Message:

Add functional workflow transition tests.

File:
1 edited

Legend:

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

    r6758 r6763  
    108108        certificate.code = 'CERT1'
    109109        certificate.application_category = 'basic'
     110        certificate.start_level = 100
     111        certificate.end_level = 500
    110112        self.app['faculties']['fac1'] = Faculty()
    111113        self.app['faculties']['fac1']['dep1'] = Department()
     
    249251        self.browser.getLink("Manage").click()
    250252        self.assertTrue('Manage study course' in self.browser.contents)
     253        # Before we can select a level, the certificate must be selected and saved
     254        self.browser.getControl(name="form.certificate").value = ['CERT1']
     255        self.browser.getControl(name="form.current_session").value = ['2004']
     256        self.browser.getControl(name="form.current_verdict").value = ['A']
     257        self.browser.getControl("Save").click()
     258        # Now we can save also the current level which depends on start and end
     259        # level of the certificate
     260        self.browser.getControl(name="form.current_level").value = ['100']
     261        self.browser.getControl("Save").click()
    251262
    252263        self.browser.open(self.student_path)
     
    266277        self.assertMatches('...Student admitted by zope.mgr...',
    267278                           self.browser.contents)
     279
     280        # Managers can pass through the whole workflow
     281        student = self.app['students'][self.test_student_id]
     282        self.browser.open(self.manage_student_path)
     283        self.assertTrue(student.clearance_locked)
     284        self.browser.getControl(name="transition").value = ['start_clearance']
     285        self.browser.getControl("Save").click()
     286        self.assertFalse(student.clearance_locked)
     287        self.browser.getControl(name="transition").value = ['request_clearance']
     288        self.browser.getControl("Save").click()
     289        self.assertTrue(student.clearance_locked)
     290        self.browser.getControl(name="transition").value = ['clear']
     291        self.browser.getControl("Save").click()
     292        self.browser.getControl(name="transition").value = ['pay_first_school_fee']
     293        self.browser.getControl("Save").click()
     294        self.browser.getControl(name="transition").value = ['reset6']
     295        self.browser.getControl("Save").click()
     296        # The pay_school_fee transition triggers some changes
     297        self.browser.getControl(name="transition").value = ['pay_school_fee']
     298        self.browser.getControl("Save").click()
     299        self.assertEqual(student['studycourse'].current_session, 2005) # was 2004
     300        self.assertEqual(student['studycourse'].current_level, 200) # was 100
     301        self.assertEqual(student['studycourse'].current_verdict, '') # was 'A'
     302        self.assertEqual(student['studycourse'].previous_verdict, 'A') # was empty
    268303        return
    269304
Note: See TracChangeset for help on using the changeset viewer.