Ignore:
Timestamp:
24 Jun 2016, 07:14:01 (8 years ago)
Author:
Henrik Bettermann
Message:

Add RefereeReportMandate?

File:
1 edited

Legend:

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

    r13987 r13988  
    3232    IMandatesContainer, IMandate)
    3333from waeup.kofa.mandates.container import MandatesContainer
    34 from waeup.kofa.mandates.mandate import PasswordMandate
     34from waeup.kofa.mandates.mandate import PasswordMandate, RefereeReportMandate
    3535from waeup.kofa.testing import (FunctionalLayer, FunctionalTestCase)
    3636
     
    191191        self.assertTrue('1 mandate(s) were purged' in self.browser.contents)
    192192        self.assertEqual(self.app['mandates'].count, (1, 0, 1))
    193         return
    194 
    195     def test_browser(self):
     193
     194    def test_browser_set_password(self):
    196195        student = createObject('waeup.Student')
    197196        self.app['students'].addStudent(student)
     
    219218        self.assertTrue('Misuse' in self.browser.contents)
    220219        self.assertEqual(self.browser.url, 'http://localhost/app/')
    221         return
     220
     221    def test_refereereport_mandate(self):
     222        mandate = RefereeReportMandate()
     223        mandate.params['name'] = u'John Referee'
     224        mandate.params['email'] = 'aa@aa.aa'
     225        mandate.params['redirect_path'] = 'applicants/87689'
     226        self.app['mandates'].addMandate(mandate)
     227        (msg, redirect_path) = mandate.execute()
     228        self.assertEqual(msg, None)
     229        self.assertEqual(redirect_path, 'applicants/87689')
     230        # Mandate has not been deleted
     231        self.assertEqual(len(self.app['mandates'].keys()), 1)
     232        mandate.params['redirect_path'] = None
     233        (msg, redirect_path) = mandate.execute()
     234        self.assertEqual(msg, 'Wrong mandate parameters.')
     235        self.assertEqual(redirect_path, '')
     236        # Add and execute an expired mandate
     237        mandate2 = RefereeReportMandate(days=0)
     238        mandate2.params['name'] = u'John Referee'
     239        mandate2.params['email'] = 'aa@aa.aa'
     240        mandate2.params['redirect_path'] = 'applicants/87689'
     241        self.app['mandates'].addMandate(mandate2)
     242        (msg, redirect_path) = mandate2.execute()
     243        self.assertEqual(msg, 'Mandate expired.')
     244        self.assertEqual(redirect_path, '')
     245        # Both mandates still exist
     246        self.assertEqual(len(self.app['mandates'].keys()), 2)
Note: See TracChangeset for help on using the changeset viewer.