Ignore:
Timestamp:
5 Aug 2020, 13:55:44 (4 years ago)
Author:
Henrik Bettermann
Message:

Implement temporarily clearance.

File:
1 edited

Legend:

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

    r16186 r16187  
    16771677        IWorkflowInfo(self.student).fireTransition('clear')
    16781678        self.assertEqual(self.student.officer_comment, None)
     1679        return
     1680
     1681    def test_handle_temp_clearance_by_co(self):
     1682        self.app['configuration']['2004'].clearance_enabled = True
     1683        self.init_clearance_officer()
     1684        # Hide real name.
     1685        self.app['users']['mrclear'].public_name = 'My Public Name'
     1686        IWorkflowInfo(self.student).fireTransition('request_clearance')
     1687        #notify(LocalRoleSetEvent(
     1688        #    self.department, 'waeup.local.ClearanceOfficer', 'mrclear',
     1689        #    granted=True))
     1690        # CO can view the student ...
     1691        self.browser.open(self.clearance_path)
     1692        self.browser.getLink("Clear student temporarily").click()
     1693        self.assertEqual(
     1694            self.browser.url, self.student_path + '/temp_clearance')
     1695        # Type comment why.
     1696        self.browser.getControl(name="form.officer_comment").value = (
     1697            'Dear Student,\n'
     1698            'Your birth cert is missing.')
     1699        self.browser.getControl(
     1700            'Save comment and clear student temporarily now').click()
     1701        self.assertTrue('Student has been temporarily cleared.'
     1702            in self.browser.contents)
     1703        url = ('http://localhost/app/students/K1000000/'
     1704              'contactstudent?body=Dear+Student%2C%0AYour+birth+cert+is+missing.'
     1705              '&subject=You+have+been+temporarily+cleared.')
     1706        # CO does now see the prefilled contact form and can send a message.
     1707        self.assertEqual(self.browser.url, url)
     1708        self.assertTrue('clearance requested' in self.browser.contents)
     1709        self.assertTrue('name="form.subject" size="20" type="text" '
     1710            'value="You have been temporarily cleared."'
     1711            in self.browser.contents)
     1712        self.assertTrue('name="form.body" rows="10" >Dear Student,'
     1713            in self.browser.contents)
     1714        self.browser.getControl("Send message now").click()
     1715        self.assertTrue('Your message has been sent' in self.browser.contents)
     1716        # The comment has been stored ...
     1717        self.assertEqual(self.student.officer_comment,
     1718            'Temporarily cleared by My Public Name. Officers comment:\n'
     1719            'Dear Student,\nYour birth cert is missing.')
     1720        # ... and logged.
     1721        logfile = os.path.join(
     1722            self.app['datacenter'].storage, 'logs', 'students.log')
     1723        logcontent = open(logfile).read()
     1724        self.assertTrue(
     1725            'INFO - mrclear - students.browser.StudentTempClearancePage - '
     1726            'K1000000 - comment: Dear Student,<br>Your birth cert is '
     1727            'missing.\n' in logcontent)
     1728        # CO can view the student bus no longer see the temp clearance button ...
     1729        self.browser.open(self.clearance_path)
     1730        self.assertFalse('Clear student temporarily' in self.browser.contents)
    16791731        return
    16801732
Note: See TracChangeset for help on using the changeset viewer.