Changeset 7413 for main


Ignore:
Timestamp:
21 Dec 2011, 06:36:38 (13 years ago)
Author:
Henrik Bettermann
Message:

Test if managers and officers can contact students.

File:
1 edited

Legend:

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

    r7372 r7413  
    351351        # and can perform actions
    352352        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    353 
    354353        self.browser.open(self.student_path)
    355354        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    408407        # Only the Application Slip does not exist
    409408        self.assertFalse('Application Slip' in self.browser.contents)
     409        return
     410
     411    def test_manage_contact_student(self):
     412        # Managers can contact student
     413        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     414        self.browser.open(self.student_path)
     415        self.browser.getLink("Send email").click()
     416        self.browser.getControl(name="form.subject").value = 'Important subject'
     417        self.browser.getControl(name="form.body").value = 'Hello!'
     418        self.browser.getControl("Send message now").click()
     419        self.assertTrue('Your message has been sent' in self.browser.contents)
    410420        return
    411421
     
    732742        # Create clearance officer
    733743        self.app['users'].addUser('mrclear', 'mrclearsecret')
     744        self.app['users']['mrclear'].email = 'mrclear@foo.ng'
     745        self.app['users']['mrclear'].title = 'Carlo Pitter'
    734746        # Clearance officers need not necessarily to get
    735747        # the StudentsOfficer site role
     
    792804        self.assertTrue('Clearance has been annulled' in self.browser.contents)
    793805        urlmessage = 'Clearance+has+been+annulled'
     806        # CO does now see the contact form
    794807        self.assertEqual(self.browser.url, self.student_path +
    795808            '/contactstudent?subject=%s' % urlmessage)
     
    803816        self.assertTrue('State: <span>clearance started</span>'
    804817            in self.browser.contents)
     818        # CO does now also see the contact form and can send a message
     819        self.browser.getControl(name="form.subject").value = 'Important subject'
     820        self.browser.getControl(name="form.body").value = 'Clearance rejected'
     821        self.browser.getControl("Send message now").click()
     822        self.assertTrue('Your message has been sent' in self.browser.contents)
    805823        # The CO can't clear students if not in state
    806824        # clearance requested
     
    818836        # Create course adviser
    819837        self.app['users'].addUser('mrsadvise', 'mrsadvisesecret')
     838        self.app['users']['mrsadvise'].email = 'mradvise@foo.ng'
     839        self.app['users']['mrsadvise'].title = 'Helen Procter'
    820840        # Assign local CourseAdviser100 role for a certificate
    821841        cert = self.app['faculties']['fac1']['dep1'].certificates['CERT1']
     
    906926        self.assertTrue('State: <span>school fee paid</span>'
    907927            in self.browser.contents)
     928        # CA does now see the contact form and can send a message
     929        self.browser.getControl(name="form.subject").value = 'Important subject'
     930        self.browser.getControl(name="form.body").value = 'Course list rejected'
     931        self.browser.getControl("Send message now").click()
     932        self.assertTrue('Your message has been sent' in self.browser.contents)
    908933        # The CA can't validate courses if not in state
    909934        # courses registered
     
    15541579        self.assertFalse('val_id' in self.browser.contents)
    15551580        return
     1581
     1582    def test_change_password_request(self):
     1583        self.browser.open('http://localhost/app/changepw')
     1584        self.browser.getControl(name="form.reg_number").value = '123'
     1585        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
     1586        self.browser.getControl("Get login credentials").click()
     1587        self.assertTrue('An email with' in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.