Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12143)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12145)
@@ -31,9 +31,11 @@
 from zope.component import createObject, queryUtility, getUtility
 from zope.component.hooks import setSite, clearSite
+from zope.schema.interfaces import ConstraintNotSatisfied
 from zope.catalog.interfaces import ICatalog
 from zope.security.interfaces import Unauthorized
 from zope.securitypolicy.interfaces import IPrincipalRoleManager
 from zope.testbrowser.testing import Browser
-from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
+from hurry.workflow.interfaces import (
+    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
 from waeup.ikoba.app import Company
@@ -1209,2 +1211,19 @@
         print "Sample contract_slip.pdf written to %s" % path
 
+    def test_contract_approval(self):
+        # This is not a UI test. It just tests the approval
+        # of contracts.
+        self.assertRaises(ConstraintNotSatisfied,
+            self.contract.document_object, self.document)
+        # Document must be at least submitted
+        IWorkflowState(self.document).setState('submitted')
+        self.contract.document_object = self.document
+        IWorkflowState(self.contract).setState('submitted')
+        self.assertRaises(InvalidTransitionError,
+            IWorkflowInfo(self.contract).fireTransition, 'approve')
+        # Document must be verified for the approval of contracts
+        IWorkflowState(self.document).setState('verified')
+        IWorkflowInfo(self.contract).fireTransition('approve')
+        self.assertEqual(IWorkflowState(self.contract).getState(), 'approved')
+        return
+
