Ignore:
Timestamp:
19 Sep 2011, 11:47:08 (13 years ago)
Author:
Henrik Bettermann
Message:

Add course list management tests.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/students
Files:
2 edited

Legend:

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

    r6796 r6799  
    659659    def addCourseTicket(self, **data):
    660660        ticket = CourseTicket()
    661         #import pdb; pdb.set_trace()
    662661        course = data['course']
    663662        ticket.core_or_elective = data['core_or_elective']
     
    675674            self.flash('The ticket exists.')
    676675            return
     676        self.flash('Successfully added %s.' % ticket.code)
    677677        self.redirect(self.url(self.context, u'@@manage')+'#tab-2')
    678678        return
  • main/waeup.sirp/trunk/src/waeup/sirp/students/tests/test_browser.py

    r6798 r6799  
    124124        self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    125125            self.certificate)
     126        self.course = createObject('waeup.Course')
     127        self.course.code = 'COURSE1'
     128        self.course.semester = 1
     129        self.course.credits = 10
     130        self.course.passmark = 40
     131        self.app['faculties']['fac1']['dep1'].courses.addCourse(
     132            self.course)
     133        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCourseRef(
     134            self.course, level=100)
    126135
    127136        # Put the prepopulated site into test ZODB and prepare test
     
    218227        self.browser.getControl("Search").click()
    219228        self.assertTrue('No student found' in self.browser.contents)
     229        return
    220230
    221231class StudentUITests(StudentsFullSetup):
     
    282292        self.assertMatches('...Student admitted by zope.mgr...',
    283293                           self.browser.contents)
     294        return
    284295
    285296    def test_manage_course_lists(self):
     
    303314        self.browser.getControl(name="addlevel").value = ['100']
    304315        self.browser.getControl("Add study level").click()
    305         self.assertMatches('...<span>100</span>...',
    306                            self.browser.contents)
     316        self.assertMatches('...<span>100</span>...', self.browser.contents)
     317        # Managers can view and manage course lists
     318        self.browser.getLink("100").click()
     319        self.assertMatches('...: Study Level 100 (Year 1)...', self.browser.contents)
     320        self.browser.getLink("Manage").click()
     321        self.browser.getControl(name="form.level_session").value = ['2002']
     322        self.browser.getControl("Save").click()
     323        ctrl = self.browser.getControl(name='val_id')
     324        ctrl.getControl(value='COURSE1').selected = True
     325        self.browser.getControl("Remove selected", index=0).click()
     326        self.assertTrue('Successfully removed' in self.browser.contents)
     327        self.browser.getControl("Add course ticket").click()
     328        self.browser.getControl(name="form.course").value = ['COURSE1']
     329        self.browser.getControl("Add course ticket").click()
     330        self.assertTrue('Successfully added' in self.browser.contents)
     331        self.browser.getLink("COURSE1").click()
     332        self.browser.getLink("Manage").click()
     333        self.browser.getControl(name="form.score").value = '10'
     334        self.browser.getControl("Save").click()
     335        self.assertTrue('Form has been saved' in self.browser.contents)
     336        return
    307337
    308338    def test_manage_workflow(self):
     
    441471        self.assertMatches('...The requested form is locked...',
    442472                           self.browser.contents)
     473        return
Note: See TracChangeset for help on using the changeset viewer.