Changeset 12221


Ignore:
Timestamp:
14 Dec 2014, 06:14:39 (10 years ago)
Author:
Henrik Bettermann
Message:

Log workflow transitions properly.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser.py

    r12220 r12221  
    229229        self.applyData(customer, **data)
    230230        self.context.addCustomer(customer)
    231         self.flash(_('Customer record created.'))
     231        self.flash(_('Customer created.'))
    232232        self.redirect(self.url(self.context[customer.customer_id], 'index'))
    233233        return
     
    525525                # know that a record was found and only the firstname
    526526                # verification failed.
    527                 self.flash(_('No customer record found.'), type="warning")
     527                self.flash(_('No customer found.'), type="warning")
    528528                return
    529529            elif customer.password is not None and self._pw_used:
     
    537537        else:
    538538            # No record found, this is the truth.
    539             self.flash(_('No customer record found.'), type="warning")
     539            self.flash(_('No customer found.'), type="warning")
    540540            return
    541541
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py

    r12216 r12221  
    140140        self.contracts_path = self.customer_path + '/contracts'
    141141
    142         self.app['configuration'].carry_over = True
    143 
    144142        # Update the catalog
    145143        notify(grok.ObjectModifiedEvent(self.customer))
     
    195193            in self.browser.contents)
    196194        self.browser.getControl(name="form.reg_number").value = '1234'
    197         self.browser.getControl("Create customer record").click()
    198         self.assertTrue('Customer record created' in self.browser.contents)
     195        self.browser.getControl("Create customer").click()
     196        self.assertTrue('Customer created' in self.browser.contents)
    199197
    200198        # Registration must be unique
     
    604602        # Customer can view history
    605603        self.browser.getLink("History").click()
    606         self.assertMatches('...Customer record created by system...',
     604        self.assertMatches('...Customer created by system...',
    607605            self.browser.contents)
    608606
     
    694692        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    695693        self.browser.getControl("Send login credentials").click()
    696         self.assertTrue('No customer record found.'
     694        self.assertTrue('No customer found.'
    697695            in self.browser.contents)
    698696        # Anonymous is not informed that firstname verification failed.
     
    703701        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    704702        self.browser.getControl("Send login credentials").click()
    705         self.assertTrue('No customer record found.'
     703        self.assertTrue('No customer found.'
    706704            in self.browser.contents)
    707705        # Even with the correct firstname we can't register if a
     
    815813
    816814class DocumentUITests(CustomersFullSetup):
    817     # Tests for CustomerSampleDocument relates views and pages
     815    # Tests for customer document related views and pages
    818816
    819817    def test_manage_document(self):
     
    877875
    878876        self.assertTrue(
     877            'INFO - system - K1000000 - d101 - Document created'
     878            in logcontent)
     879        self.assertTrue(
     880            'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
     881            '- K1000000 - added: PDF Document %s'
     882            % document.document_id in logcontent)
     883        self.assertTrue(
    879884            'INFO - zope.mgr - customers.browser.DocumentManageFormPage '
    880885            '- K1000000 - d102 - saved: title'
    881886            in logcontent)
    882887        self.assertTrue(
    883             'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
    884             '- K1000000 - added: PDF Document %s'
    885             % document.document_id in logcontent)
     888            'INFO - zope.mgr - K1000000 - d102 - Submitted for verification'
     889            in logcontent)
    886890        self.assertTrue(
    887891            'INFO - zope.mgr - customers.browser.DocumentsManageFormPage '
    888             '- K1000000 - removed: %s'
    889             % document.document_id in logcontent)
     892            '- K1000000 - removed: d102'
     893            in logcontent)
    890894
    891895    def test_edit_sample_document(self):
     
    11281132
    11291133class ContractUITests(CustomersFullSetup):
    1130     # Tests for CustomerSampleContract relates views and pages
     1134    # Tests for contract related views and pages
    11311135
    11321136    def test_manage_contract(self):
     
    11761180        logcontent = open(logfile).read()
    11771181        self.assertTrue(
     1182            'INFO - zope.mgr - K1000000 - c102 - Contract created'
     1183            in logcontent)
     1184        self.assertTrue(
     1185            'INFO - zope.mgr - customers.browser.ContractAddFormPage '
     1186            '- K1000000 - added: Sample Contract %s'
     1187            % contract.contract_id in logcontent)
     1188        self.assertTrue(
    11781189            'INFO - zope.mgr - customers.browser.ContractManageFormPage '
    11791190            '- K1000000 - c102 - saved: title'
    11801191            in logcontent)
    11811192        self.assertTrue(
    1182             'INFO - zope.mgr - customers.browser.ContractAddFormPage '
    1183             '- K1000000 - added: Sample Contract %s'
    1184             % contract.contract_id in logcontent)
     1193            'INFO - zope.mgr - K1000000 - c102 - Submitted for approval'
     1194            in logcontent)
     1195        self.assertTrue(
     1196            'INFO - zope.mgr - K1000000 - c102 - Approved'
     1197            in logcontent)
    11851198        self.assertTrue(
    11861199            'INFO - zope.mgr - customers.browser.ContractsManageFormPage '
    1187             '- K1000000 - removed: %s'
    1188             % contract.contract_id in logcontent)
     1200            '- K1000000 - removed: c102'
     1201            in logcontent)
    11891202
    11901203    def test_edit_sample_contract(self):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_contract.py

    r12196 r12221  
    8888        IWorkflowInfo(doc).fireTransition('create')
    8989        messages = ' '.join(doc.history.messages)
    90         self.assertTrue('Contract record created by system' in messages)
     90        self.assertTrue('Contract created by system' in messages)
    9191        return
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12210 r12221  
    9494            'sex,suspended,suspended_comment,password,state,history\r\n'
    9595            'A111111,anna@sample.com,Anna,Tester,M.,+234-123-12345#,123,,0,,,'
    96             'created,[u\'2014-12-04 11:25:35 UTC - Customer record created '
     96            'created,[u\'2014-12-04 11:25:35 UTC - Customer created '
    9797            'by system\']\r\n',
    9898            result
     
    274274
    275275            'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - '
    276             'Contract record created by system\'],,'
     276            'Contract created by system\'],,'
    277277            'SAM,created,My Contract\r\n',
    278278            result
     
    293293
    294294            'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - '
    295             'Contract record created by system\'],,'
     295            'Contract created by system\'],,'
    296296            'SAM,created,My Contract\r\n',
    297297            result
     
    312312
    313313            'SampleContract,sample,c101,d101,[u\'2014-12-04 12:10:46 UTC - '
    314             'Contract record created by system\'],,'
     314            'Contract created by system\'],,'
    315315            'SAM,created,My Contract\r\n',
    316316            result
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/workflow.py

    r12213 r12221  
    4646        source = None,
    4747        condition = NullCondition,
    48         msg = _('Customer record created'),
     48        msg = _('Customer created'),
    4949        destination = CREATED),
    5050
     
    150150    Transition(
    151151        transition_id = 'create',
    152         title = _('Create contract record'),
     152        title = _('Create contract'),
    153153        source = None,
    154154        condition = NullCondition,
    155         msg = _('Contract record created'),
     155        msg = _('Contract created'),
    156156        destination = CREATED),
    157157
     
    254254    try:
    255255        customers_container = grok.getSite()['customers']
    256         customers_container.logger.info('%s - %s' % (obj.customer_id,msg))
     256        customers_container.logger.info(
     257            '%s - %s - %s' % (obj.customer.customer_id, obj.contract_id, msg))
    257258    except (TypeError, AttributeError):
    258259        pass
     
    370371    try:
    371372        customers_container = grok.getSite()['customers']
    372         customers_container.logger.info('%s - %s' % (obj.customer_id,msg))
     373        customers_container.logger.info(
     374            '%s - %s - %s' % (obj.customer.customer_id, obj.document_id, msg))
    373375    except (TypeError, AttributeError):
    374376        pass
Note: See TracChangeset for help on using the changeset viewer.