Changeset 14952


Ignore:
Timestamp:
9 Feb 2018, 19:52:16 (7 years ago)
Author:
Henrik Bettermann
Message:

Do not log error messages.
Improve Student Creation Report.
Adjust tests.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r14951 r14952  
    721721                ob_class = self.__implemented__.__name__.replace(
    722722                    'waeup.kofa.','')
    723                 applicants_root.logger.info(
    724                     '%s - %s - %s' % (ob_class, result.applicant_id, msg))
    725 
    726723        grok.getSite()['configuration'].maintmode_enabled_by = None
    727724        self.successful = ', '.join(created)
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser_templates/createallstudentspage.pt

    r14951 r14952  
    11<div i18n:domain="waeup.kofa">
    2   <strong i18n:translate="">Successfully created records:</strong>
    3   <br />
    4   <div  tal:replace="structure view/successful">
    5   </div>
    6   <br />
    7   <strong i18n:translate="">Failed records:</strong>
    8   <br />
    9   <div  tal:repeat="value view/failed">
    10     <a tal:attributes="href python:value[1]" tal:content="python:value[0]"> ID</a>
    11     (<span tal:content="python:value[2]">MSG</span>)
    12   </div>
     2  <tal:success condition="view/successful">
     3    <strong i18n:translate="">Successfully created records:</strong>
     4    <br />
     5    <div  tal:replace="structure view/successful">
     6    </div>
     7    <br />
     8  </tal:success>
     9  <tal:fail condition="view/failed">
     10    <strong i18n:translate="">Failed records:</strong>
     11    <br />
     12    <div  tal:repeat="value view/failed">
     13      <a tal:attributes="href python:value[1]" tal:content="python:value[0]"> ID</a>
     14      (<span tal:content="python:value[2]">MSG</span>)
     15    </div>
     16  </tal:fail>
     17  <tal:norecord i18n:translate=""
     18       condition="python:not view.failed and not view.successful">
     19      No record found.
     20  </tal:norecord>
    1321</div>
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py

    r14949 r14952  
    161161        self.browser.open(self.container_path + '/createallstudents')
    162162        self.assertTrue('No record found' in self.browser.contents)
     163        self.assertFalse('Failed records' in self.browser.contents)
     164        self.assertFalse('Successfully created records' in self.browser.contents)
    163165        IWorkflowState(self.applicant).setState('admitted')
    164166        notify(grok.ObjectModifiedEvent(self.applicant))
    165167        self.browser.open(self.container_path + '/createallstudents')
    166168        self.assertTrue('No course admitted provided' in self.browser.contents)
    167         logcontent = open(logfile).read()
    168         self.assertTrue('No course admitted provided' in logcontent)
     169        self.assertFalse('Successfully created records' in self.browser.contents)
     170        self.assertTrue('Failed records' in self.browser.contents)
    169171        self.browser.open(self.manage_path)
    170172        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
     
    174176        self.browser.open(self.container_path + '/createallstudents')
    175177        self.assertTrue('RequiredMissing: date_of_birth' in self.browser.contents)
    176         logcontent = open(logfile).read()
    177         self.assertTrue('RequiredMissing: date_of_birth' in logcontent)
     178        self.assertTrue('Failed records' in self.browser.contents)
     179        self.assertFalse('Successfully created records' in self.browser.contents)
    178180        self.browser.open(self.manage_path)
    179181        self.browser.getControl(name="form.date_of_birth").value = '09/09/1988'
    180182        self.browser.getControl("Save").click()
    181183        self.browser.open(self.container_path + '/createallstudents')
    182         self.assertTrue('1 students successfully created' in self.browser.contents)
     184        self.assertFalse('Failed records' in self.browser.contents)
     185        self.assertTrue('Successfully created records' in self.browser.contents)
    183186
    184187    def test_hidden_batch_copying_all(self):
     
    195198        self.browser.open(self.root_path + '/createallstudents')
    196199        self.assertTrue('No course admitted provided' in self.browser.contents)
    197         logcontent = open(logfile).read()
    198         self.assertTrue('No course admitted provided' in logcontent)
    199200        self.applicant.course_admitted = self.certificate
    200201        self.browser.open(self.root_path + '/createallstudents')
    201         self.assertTrue('1 students successfully created' in self.browser.contents)
     202        self.assertTrue('Successfully created records:' in self.browser.contents)
    202203
    203204    def test_copier_wo_passport(self):
     
    241242            'IOError: Application Slip could not be created.'
    242243            in self.browser.contents)
    243         logfile = os.path.join(
    244             self.app['datacenter'].storage, 'logs', 'applicants.log')
    245         logcontent = open(logfile).read()
    246         self.assertTrue(
    247             'IOError: Application Slip could not be created.' in logcontent)
    248244
    249245    def disabled_test_delay(self):
Note: See TracChangeset for help on using the changeset viewer.