Changeset 8859


Ignore:
Timestamp:
30 Jun 2012, 07:58:20 (12 years ago)
Author:
Henrik Bettermann
Message:

Add test_set_applicant_password. Fix if statement in _setPassword.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py

    r8858 r8859  
    5757        user = self.params.get('user', None)
    5858        pwd = self.params.get('password', None)
    59         if user and pwd:
     59        if not None in (user, pwd):
    6060            try:
    6161                IUserAccount(user).setPassword(pwd)
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py

    r8858 r8859  
    8686    def test_set_student_password(self):
    8787        student = createObject('waeup.Student')
    88         self.app['students'].addStudent(student)
    8988        # Add and execute a mandate with missing parameters.
    9089        mandate = PasswordMandate()
     
    123122        self.assertTrue(IUserAccount(officer).checkPassword('mypwd1'))
    124123
     124    def test_set_applicant_password(self):
     125        applicant = createObject('waeup.Applicant')
     126        mandate = PasswordMandate()
     127        mandate.params['user'] = applicant
     128        mandate.params['password'] = 'mypwd1'
     129        self.app['mandates'].addMandate(mandate)
     130        msg = mandate.execute()
     131        # Password has been set.
     132        self.assertEqual(msg, 'Password has been successfully set. Proceed to '
     133            'the login page and enter your credentials.')
     134        self.assertTrue(IUserAccount(applicant).checkPassword('mypwd1'))
     135
    125136    def test_remove_expired(self):
    126137        # mandate1 is an old mandate which just expired.
Note: See TracChangeset for help on using the changeset viewer.