Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv	(revision 12130)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/sample_contract_data.csv	(revision 12131)
@@ -1,6 +1,8 @@
-class_name,contract_id,reg_number,title
-SampleContract,c3,1,My first contract
-SampleContract,c4,2,My second contract
-SampleContract,c5,3,My third contract
-SampleContract,,1,My 4th contract
-SampleContract,c5,2,My stolen contract
+class_name,contract_id,reg_number,title,product_object,document_object
+SampleContract,c3,1,My first contract,SAM,d101
+SampleContract,c4,2,My second contract,SAM,d101
+SampleContract,c5,3,My third contract,SAM,d101
+SampleContract,,1,My 4th contract,SAM,d101
+SampleContract,c5,2,My stolen contract,SAM,d101
+SampleContract,c6,3,My 5th contract,SAM,NONEXISTENT
+SampleContract,c7,3,My sixt contract,NONEXISTENT,d101
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py	(revision 12130)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_batching.py	(revision 12131)
@@ -34,5 +34,6 @@
 
 from waeup.ikoba.app import Company
-from waeup.ikoba.interfaces import IBatchProcessor, FatalCSVError, IUserAccount
+from waeup.ikoba.interfaces import (
+    IBatchProcessor, FatalCSVError, IUserAccount, VERIFIED)
 from waeup.ikoba.customers.batching import (
     CustomerProcessor, CustomerDocumentProcessor, ContractProcessor)
@@ -132,4 +133,5 @@
         document.title = u'My Document'
         customer['documents'].addDocument(document)
+        IWorkflowState(document).setState(VERIFIED)
         self.document = document
         # Add contract
@@ -464,5 +466,6 @@
     def test_checkConversion(self):
         errs, inv_errs, conv_dict = self.processor.checkConversion(
-            dict(contract_id='c126', class_name='SampleContract'))
+            dict(contract_id='c126', class_name='SampleContract',
+                 document_object='d101', product_object='SAM'))
         self.assertEqual(len(errs),0)
         errs, inv_errs, conv_dict = self.processor.checkConversion(
@@ -476,10 +479,16 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, CONTRACT_HEADER_FIELDS,'create')
-        self.assertEqual(num_warns,1)
+        self.assertEqual(num_warns,3)
         # contract_id must be unique
         fail_file = open(fail_file).read()
         self.assertEqual(fail_file,
-            'class_name,reg_number,contract_id,title,--ERRORS--\r\n'
-            'SampleContract,2,c5,My stolen contract,contract_id: id exists\r\n')
+            'reg_number,contract_id,title,class_name,product_object,'
+            'document_object,--ERRORS--\r\n'
+            '2,c5,My stolen contract,SampleContract,SAM,d101,'
+            'contract_id: id exists\r\n'
+            '3,c6,My 5th contract,SampleContract,SAM,NONEXISTENT,'
+            'document_object: Invalid value\r\n'
+            '3,c7,My sixt contract,SampleContract,NONEXISTENT,d101,'
+            'product_object: Invalid value\r\n')
         contract = self.processor.getEntry(dict(reg_number='1',
             contract_id='c3'), self.app)
@@ -508,6 +517,7 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, CONTRACT_HEADER_FIELDS,'update')
-        # There is one record without contract_id and one duplicate
-        self.assertEqual(num_warns,2)
+        # There are one record without contract_id, one duplicate and two
+        # records with wrong object identifier.
+        self.assertEqual(num_warns,4)
         shutil.rmtree(os.path.dirname(fin_file))
 
@@ -521,6 +531,7 @@
         num, num_warns, fin_file, fail_file = self.processor.doImport(
             self.csv_file, CONTRACT_HEADER_FIELDS,'remove')
-        # There is one record without contract_id and one duplicate
-        self.assertEqual(num_warns,2)
+        # There are one record without contract_id, one duplicate and two 
+        # records with wrong object identifier.
+        self.assertEqual(num_warns,4)
         shutil.rmtree(os.path.dirname(fin_file))
         logcontent = open(self.logfile).read()
Index: /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py
===================================================================
--- /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py	(revision 12130)
+++ /main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py	(revision 12131)
@@ -159,5 +159,5 @@
         self.assertEqual(
             result,
-            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
+            'class_name,document_id,history,last_transition_date,state,title,user_id\r\n'
             'CustomerSampleDocument,d101,[],,,,\r\n'
             )
@@ -173,5 +173,5 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
+            'class_name,document_id,history,last_transition_date,state,title,user_id\r\n'
             in result
             )
@@ -179,5 +179,5 @@
             '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
             'Document created by system\'],2014-11-25 06:57:24.990308#,'
-            'created,My Document,A111111...',
+            'verified,My Document,A111111...',
             result
             )
@@ -192,10 +192,10 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
+            'class_name,document_id,history,last_transition_date,state,title,user_id\r\n'
             in result)
         self.assertMatches(
             '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
             'Document created by system\'],2014-11-25 06:57:24.990308#,'
-            'created,My Document,A111111...',
+            'verified,My Document,A111111...',
             result
             )
@@ -210,10 +210,10 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'class_name,document_id,history,last_transition_date,state,title,customer_id\r\n'
+            'class_name,document_id,history,last_transition_date,state,title,user_id\r\n'
             in result)
         self.assertMatches(
             '...CustomerSampleDocument,d101,[u\'2014-11-25 06:57:24 UTC - '
             'Document created by system\'],2014-11-25 06:57:24.990308#,'
-            'created,My Document,A111111...',
+            'verified,My Document,A111111...',
             result
             )
