Ignore:
Timestamp:
30 Aug 2012, 06:28:17 (12 years ago)
Author:
Henrik Bettermann
Message:

Add buttons and views for activating and deactivating student accounts.

Add history messages and log entries when students are being activated or deactivated.

File:
1 edited

Legend:

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

    r9123 r9124  
    19181918        self.assertTrue('Employer' in self.browser.contents)
    19191919
     1920    def test_activate_deactivate_buttons(self):
     1921        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     1922        self.browser.open(self.student_path)
     1923        self.browser.getLink("Deactivate").click()
     1924        self.assertTrue(
     1925            'Student account has been deactivated.' in self.browser.contents)
     1926        self.assertTrue(
     1927            'Base Data (account deactivated)' in self.browser.contents)
     1928        self.assertTrue(self.student.suspended)
     1929        self.browser.getLink("Activate").click()
     1930        self.assertTrue(
     1931            'Student account has been activated.' in self.browser.contents)
     1932        self.assertFalse(
     1933            'Base Data (account deactivated)' in self.browser.contents)
     1934        self.assertFalse(self.student.suspended)
     1935        # History messages have been added ...
     1936        self.browser.getLink("History").click()
     1937        self.assertTrue(
     1938            'Student account deactivated by Manager<br />' in self.browser.contents)
     1939        self.assertTrue(
     1940            'Student account activated by Manager<br />' in self.browser.contents)
     1941        # ... and actions have been logged.
     1942        logfile = os.path.join(
     1943            self.app['datacenter'].storage, 'logs', 'students.log')
     1944        logcontent = open(logfile).read()
     1945        self.assertTrue('zope.mgr - students.browser.StudentDeactivatePage - '
     1946                        'K1000000 - account deactivated' in logcontent)
     1947        self.assertTrue('zope.mgr - students.browser.StudentActivatePage - '
     1948                        'K1000000 - account activated' in logcontent)
     1949
    19201950class StudentRequestPWTests(StudentsFullSetup):
    19211951    # Tests for student registration
Note: See TracChangeset for help on using the changeset viewer.