Ignore:
Timestamp:
4 Dec 2014, 18:11:12 (10 years ago)
Author:
Henrik Bettermann
Message:

Undo the approval of contract and raise an exception if contract
does not meet the requirements for approval.

File:
1 edited

Legend:

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

    r12119 r12145  
    3131from zope.component import createObject, queryUtility, getUtility
    3232from zope.component.hooks import setSite, clearSite
     33from zope.schema.interfaces import ConstraintNotSatisfied
    3334from zope.catalog.interfaces import ICatalog
    3435from zope.security.interfaces import Unauthorized
    3536from zope.securitypolicy.interfaces import IPrincipalRoleManager
    3637from zope.testbrowser.testing import Browser
    37 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
     38from hurry.workflow.interfaces import (
     39    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
    3840from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
    3941from waeup.ikoba.app import Company
     
    12091211        print "Sample contract_slip.pdf written to %s" % path
    12101212
     1213    def test_contract_approval(self):
     1214        # This is not a UI test. It just tests the approval
     1215        # of contracts.
     1216        self.assertRaises(ConstraintNotSatisfied,
     1217            self.contract.document_object, self.document)
     1218        # Document must be at least submitted
     1219        IWorkflowState(self.document).setState('submitted')
     1220        self.contract.document_object = self.document
     1221        IWorkflowState(self.contract).setState('submitted')
     1222        self.assertRaises(InvalidTransitionError,
     1223            IWorkflowInfo(self.contract).fireTransition, 'approve')
     1224        # Document must be verified for the approval of contracts
     1225        IWorkflowState(self.document).setState('verified')
     1226        IWorkflowInfo(self.contract).fireTransition('approve')
     1227        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
     1228        return
     1229
Note: See TracChangeset for help on using the changeset viewer.