Changeset 8436 for main/waeup.kofa/trunk


Ignore:
Timestamp:
13 May 2012, 03:49:37 (13 years ago)
Author:
Henrik Bettermann
Message:

Catch error when sending the contact form but no email address is provided.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
2 edited

Legend:

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

    r8434 r8436  
    472472        # Managers can contact student
    473473        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     474        self.student.email = None
    474475        self.browser.open(self.student_path)
    475476        self.browser.getLink("Send email").click()
    476477        self.browser.getControl(name="form.subject").value = 'Important subject'
    477478        self.browser.getControl(name="form.body").value = 'Hello!'
     479        self.browser.getControl("Send message now").click()
     480        self.assertTrue('An smtp server error occurred' in self.browser.contents)
     481        self.student.email = 'xx@yy.zz'
    478482        self.browser.getControl("Send message now").click()
    479483        self.assertTrue('Your message has been sent' in self.browser.contents)
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r8181 r8436  
    165165        body = translate(text, 'waeup.kofa',
    166166            target_language=self.PORTAL_LANGUAGE)
     167        if not (from_addr and rcpt_addr):
     168            return False
    167169        return send_mail(
    168170            from_name,from_addr,rcpt_name,rcpt_addr,subject,body,config)
Note: See TracChangeset for help on using the changeset viewer.