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 12007)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12015)
@@ -1,3 +1,3 @@
-## $Id: test_browser.py 11862 2014-10-21 07:07:04Z henrik $
+## $Id$
 ## 
 ## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
@@ -101,4 +101,7 @@
         self.customer_id = customer.customer_id
         self.customer = self.app['customers'][self.customer_id]
+        document = createObject('waeup.CustomerDocument')
+        document.title = u'My first document'
+        self.customer['documents'].addDocument(document)
 
         # Set password
@@ -114,4 +117,5 @@
         self.trigtrans_path = self.customer_path + '/trigtrans'
         self.history_path = self.customer_path + '/history'
+        self.documents_path = self.customer_path + '/documents'
 
         self.app['configuration'].carry_over = True
@@ -766,2 +770,42 @@
             'job_id=%s' % job_id in logcontent
             )
+
+
+class CustomerDocumentUITests(CustomersFullSetup):
+    # Tests for CustomerDocument relates views and pages
+
+    def test_manage_document(self):
+        # Managers can access the pages of customer documentsconter
+        # and can perform actions
+        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
+        self.browser.open(self.customer_path)
+        self.assertEqual(self.browser.headers['Status'], '200 Ok')
+        self.assertEqual(self.browser.url, self.customer_path)
+        self.browser.open(self.customer_path)
+        self.browser.getLink("Documents").click()
+        self.browser.getLink("Add document").click()
+        self.browser.getControl(name="doctype").value = ['generic']
+        self.browser.getControl("Create document").click()
+        self.assertTrue('Generic Document created.' in self.browser.contents)
+        document = self.customer['documents']['d102']
+
+        # Documents can be removed
+        ctrl = self.browser.getControl(name='val_id')
+        ctrl.getControl(value=document.document_id).selected = True
+        self.browser.getControl("Remove selected", index=0).click()
+        self.assertTrue('Successfully removed' in self.browser.contents)
+
+        # All actions are being logged
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'customers.log')
+        logcontent = open(logfile).read()
+
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
+            '- K1000000 - added: Generic Document %s'
+            % document.document_id in logcontent)
+
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.DocumentsManageFormPage '
+            '- K1000000 - removed: %s'
+            % document.document_id in logcontent)
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 12007)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py	(revision 12015)
@@ -138,6 +138,6 @@
         self.assertEqual(
             result,
-            'doctype,document_id,history,title,customer_id\r\n'
-            ',d101,[],,\r\n'
+            'document_id,history,title,customer_id\r\n'
+            'd101,[],,\r\n'
             )
         return
@@ -152,5 +152,5 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'doctype,document_id,history,title,customer_id\r\n'
+            'document_id,history,title,customer_id\r\n'
             in result
             )
@@ -169,5 +169,5 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'doctype,document_id,history,title,customer_id\r\n'
+            'document_id,history,title,customer_id\r\n'
             in result)
         self.assertTrue(
@@ -184,5 +184,5 @@
         result = open(self.outfile, 'rb').read()
         self.assertTrue(
-            'doctype,document_id,history,title,customer_id\r\n'
+            'document_id,history,title,customer_id\r\n'
             in result)
         self.assertTrue(
