Ignore:
Timestamp:
30 Aug 2012, 08:55:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Quick shot: Remove single history messages through URL. All views in the utils.browser module should be replaced by proper form pages.

File:
1 edited

Legend:

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

    r9122 r9127  
    6262            self.student.history.messages[0])
    6363
     64    def test_remove_student_history_message(self):
     65        self.assertTrue('Record created by system' in
     66            self.student.history.messages[0])
     67        self.assertEqual(len(self.student.history.messages),1)
     68        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     69        self.browser.open('http://localhost/app/remove_student_history_message')
     70        self.assertTrue(
     71            'Syntax: /remove_student_history_message?student_id=[id]&number=[line number, starting with 0]'
     72            in self.browser.contents)
     73        self.browser.open(
     74            'http://localhost/app/remove_student_history_message?student_id=%s&number=0' % self.student.student_id)
     75        self.assertTrue('Finished' in self.browser.contents)
     76        self.assertEqual(len(self.student.history.messages),0)
     77        logfile = os.path.join(
     78            self.app['datacenter'].storage, 'logs', 'main.log')
     79        logcontent = open(logfile).read()
     80        self.assertMatches(
     81            "...zope.mgr - line '<YYYY-MM-DD hh:mm:ss> UTC - "
     82            "Record created by system' removed in K1000000 history",
     83            logcontent)
     84
    6485    def test_reindex(self):
    6586        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    96117        self.assertTrue('Application initialized by me' in
    97118            self.applicant.history.messages[0])
     119
     120    def test_remove_applicant_history_message(self):
     121        self.assertTrue('Application initialized by system' in
     122            self.applicant.history.messages[0])
     123        self.assertEqual(len(self.applicant.history.messages),1)
     124        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     125        self.browser.open('http://localhost/app/remove_applicant_history_message')
     126        self.assertTrue(
     127            'Syntax: /remove_applicant_history_message?applicant_id=[id]&number=[line number, starting with 0]'
     128            in self.browser.contents)
     129        self.browser.open(
     130            'http://localhost/app/remove_applicant_history_message?applicant_id=%s&number=0' % self.applicant.applicant_id)
     131        self.assertTrue('Finished' in self.browser.contents)
     132        self.assertEqual(len(self.applicant.history.messages),0)
     133        logfile = os.path.join(
     134            self.app['datacenter'].storage, 'logs', 'main.log')
     135        logcontent = open(logfile).read()
     136        self.assertMatches(
     137            "...zope.mgr - line '<YYYY-MM-DD hh:mm:ss> UTC - "
     138            "Application initialized by system' removed in %s history"
     139            % self.applicant.applicant_id, logcontent)
Note: See TracChangeset for help on using the changeset viewer.