Ignore:
Timestamp:
21 Sep 2011, 10:34:06 (13 years ago)
Author:
Henrik Bettermann
Message:

Add some student UI tests.

File:
1 edited

Legend:

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

    r6804 r6809  
    7575        student.matric_number = u'234'
    7676        self.test_student_id = self.app['students'].addStudent(student)
     77        self.student = self.app['students'][self.test_student_id]
     78
    7779        # Set password
    7880        IUserAccount(
     
    134136            self.course, level=100)
    135137
     138        # Set study course attributes of test student
     139        self.student['studycourse'].certificate = self.certificate
     140        self.student['studycourse'].current_session = 2004
     141        self.student['studycourse'].current_verdict = 'A'
     142        self.student['studycourse'].current_level = 100
     143
    136144        # Put the prepopulated site into test ZODB and prepare test
    137145        # browser
     
    366374        # In state returning the pay_school_fee transition triggers some
    367375        # changes of attributes
    368         student['studycourse'].certificate = self.certificate
    369         student['studycourse'].current_session = 2004
    370         student['studycourse'].current_verdict = 'A'
    371         student['studycourse'].current_level = 100
    372376        self.browser.getControl(name="transition").value = ['pay_school_fee']
    373377        self.browser.getControl("Save").click()
     
    507511        self.assertMatches('...The requested form is locked...',
    508512                           self.browser.contents)
    509         return
     513        IWorkflowInfo(student).fireTransition('clear')
     514        IWorkflowInfo(student).fireTransition('pay_first_school_fee')
     515        # Students can add the current study level
     516        self.browser.getLink("Study Course").click()
     517        self.browser.getLink("Add course list").click()
     518        self.assertMatches('...Add current level 100 (Year 1)...',
     519                           self.browser.contents)
     520        self.browser.getControl("Create course list now").click()
     521        self.browser.getLink("100").click()
     522        self.browser.getLink("Add and remove courses").click()
     523        self.browser.getControl("Add course ticket").click()
     524        self.browser.getControl(name="form.course").value = ['COURSE1']
     525        self.browser.getControl("Add course ticket").click()
     526        self.assertMatches('...The ticket exists...',
     527                           self.browser.contents)
     528        self.student['studycourse'].current_level = 200
     529        self.browser.getLink("Study Course").click()
     530        self.browser.getLink("Add course list").click()
     531        self.assertMatches('...Add current level 200 (Year 2)...',
     532                           self.browser.contents)
     533        self.browser.getControl("Create course list now").click()
     534        self.browser.getLink("200").click()
     535        self.browser.getLink("Add and remove courses").click()
     536        self.browser.getControl("Add course ticket").click()
     537        self.browser.getControl(name="form.course").value = ['COURSE1']
     538        self.browser.getControl("Add course ticket").click()
     539        self.assertMatches('...Successfully added COURSE1...',
     540                           self.browser.contents)
     541        ctrl = self.browser.getControl(name='val_id')
     542        ctrl.getControl(value='COURSE1').selected = True
     543        self.browser.getControl("Remove selected", index=0).click()
     544        self.assertTrue('Successfully removed' in self.browser.contents)
     545        return
Note: See TracChangeset for help on using the changeset viewer.