Changeset 8860


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

Add log message.

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

    r8859 r8860  
    5151
    5252class PasswordMandate(Mandate):
    53     """This is a mandate which can set a student password.
     53    """This is a mandate which can set a password.
    5454    """
    5555
     
    7272            msg = _('Password has been successfully set. '
    7373                    'Proceed to the login page and enter your credentials.')
     74            username = IUserAccount(self.params['user']).name
     75            grok.getSite().logger.info(
     76                'PasswordMandate used: %s ' % username)
    7477        del self.__parent__[self.mandate_id]
    7578        return msg
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py

    r8859 r8860  
    2121import tempfile
    2222import shutil
     23import os
    2324from zope.testbrowser.testing import Browser
    2425from datetime import datetime, timedelta
     
    108109        # All mandates have been removed.
    109110        self.assertEqual(len(self.app['mandates'].keys()), 0)
     111        logfile = os.path.join(
     112            self.app['datacenter'].storage, 'logs', 'main.log')
     113        logcontent = open(logfile).read()
     114        self.assertTrue('system - PasswordMandate used: K1000000' in logcontent)
    110115
    111116    def test_set_officer_password(self):
     
    121126            'the login page and enter your credentials.')
    122127        self.assertTrue(IUserAccount(officer).checkPassword('mypwd1'))
     128        logfile = os.path.join(
     129            self.app['datacenter'].storage, 'logs', 'main.log')
     130        logcontent = open(logfile).read()
     131        self.assertTrue('system - PasswordMandate used: bob' in logcontent)
    123132
    124133    def test_set_applicant_password(self):
    125134        applicant = createObject('waeup.Applicant')
     135        applicant.applicant_id = u'abc'
    126136        mandate = PasswordMandate()
    127137        mandate.params['user'] = applicant
     
    133143            'the login page and enter your credentials.')
    134144        self.assertTrue(IUserAccount(applicant).checkPassword('mypwd1'))
     145        logfile = os.path.join(
     146            self.app['datacenter'].storage, 'logs', 'main.log')
     147        logcontent = open(logfile).read()
     148        self.assertTrue('system - PasswordMandate used: abc' in logcontent)
    135149
    136150    def test_remove_expired(self):
Note: See TracChangeset for help on using the changeset viewer.