Index: main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py
===================================================================
--- main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py	(revision 14190)
+++ main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_browser.py	(revision 14197)
@@ -222,9 +222,9 @@
     def setup_customizable_params(self):
         self._contract_category = u'riaa'
-        self._document_factory = 'waeup.UnibenCustomerDocument'
+        self._document_factory = 'waeup.UnibenCustomerPDFDocument'
         self._contract_factory = 'waeup.RIAAContract'
         return
 
-    def test_manage_upload_sample_file(self):
+    def test_manage_upload_pdf_file(self):
         # Managers can upload a file via the DocumentManageFormPage
         # The image is stored even if form has errors
@@ -232,69 +232,37 @@
         self.browser.open(self.customer_path + '/documents/DOC1/manage')
         # Create a pseudo image file and select it to be uploaded
-        image = open(SAMPLE_IMAGE, 'rb')
-        ctrl = self.browser.getControl(name='samplescanmanageupload')
+        image = open(SAMPLE_PDF, 'rb')
+        ctrl = self.browser.getControl(name='pdfscanmanageupload')
         file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(image, filename='my_sample_scan.jpg')
+        file_ctrl.add_file(image, filename='my_sample_scan.pdf')
         # The Save action does not upload files
         self.browser.getControl("Save").click() # submit form
         self.assertFalse(
-            'href="http://localhost/app/customers/B1000000/documents/DOC1/sample"'
+            'href="http://localhost/app/customers/B1000000/documents/DOC1/scan.pdf"'
             in self.browser.contents)
         # ... but the correct upload submit button does
-        image = open(SAMPLE_IMAGE)
-        ctrl = self.browser.getControl(name='samplescanmanageupload')
+        image = open(SAMPLE_PDF)
+        ctrl = self.browser.getControl(name='pdfscanmanageupload')
         file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(image, filename='my_sample_scan.jpg')
+        file_ctrl.add_file(image, filename='my_sample_scan.pdf')
         self.browser.getControl(
-            name='upload_samplescanmanageupload').click()
+            name='upload_pdfscanmanageupload').click()
         self.assertTrue(
-            'href="http://localhost/app/customers/B1000000/documents/DOC1/sample"'
+            'href="http://localhost/app/customers/B1000000/documents/DOC1/scan.pdf"'
             in self.browser.contents)
-        # Browsing the link shows a real image
-        self.browser.open('sample')
+        # Browsing the link shows a real pdf file
+        self.browser.open('scan.pdf')
         self.assertEqual(
-            self.browser.headers['content-type'], 'image/jpeg')
-        self.assertEqual(len(self.browser.contents), 2787)
+            self.browser.headers['content-type'], 'application/pdf')
+        self.assertEqual(len(self.browser.contents), 24241)
         # We can't reupload a file. The existing file must be deleted first.
         self.browser.open(self.customer_path + '/documents/DOC1/manage')
         self.assertFalse(
-            'upload_samplescanmanageupload' in self.browser.contents)
+            'upload_pdfscanmanageupload' in self.browser.contents)
         # File must be deleted first
-        self.browser.getControl(name='delete_samplescanmanageupload').click()
+        self.browser.getControl(name='delete_pdfscanmanageupload').click()
         self.assertTrue(
-            'sample deleted' in self.browser.contents)
-        # Uploading a file which is bigger than 150k will raise an error
-        big_image = StringIO(open(SAMPLE_IMAGE, 'rb').read() * 75)
-        ctrl = self.browser.getControl(name='samplescanmanageupload')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(big_image, filename='my_sample_scan.jpg')
-        self.browser.getControl(
-            name='upload_samplescanmanageupload').click()
-        self.assertTrue(
-            'Uploaded file is too big' in self.browser.contents)
-        # We do not rely on filename extensions given by uploaders
-        image = open(SAMPLE_IMAGE, 'rb') # a jpg-file
-        ctrl = self.browser.getControl(name='samplescanmanageupload')
-        file_ctrl = ctrl.mech_control
-        # Tell uploaded file is bmp
-        file_ctrl.add_file(image, filename='my_sample_scan.bmp')
-        self.browser.getControl(
-            name='upload_samplescanmanageupload').click()
-        self.assertTrue(
-            # jpg file was recognized
-            'File sample.jpg uploaded.' in self.browser.contents)
-        # Delete file again
-        self.browser.getControl(name='delete_samplescanmanageupload').click()
-        self.assertTrue(
-            'sample deleted' in self.browser.contents)
-        # File names must meet several conditions
-        bmp_image = open(SAMPLE_IMAGE_BMP, 'rb')
-        ctrl = self.browser.getControl(name='samplescanmanageupload')
-        file_ctrl = ctrl.mech_control
-        file_ctrl.add_file(bmp_image, filename='my_sample_scan.bmp')
-        self.browser.getControl(
-            name='upload_samplescanmanageupload').click()
-        self.assertTrue('Only the following extensions are allowed'
-            in self.browser.contents)
+            'scan.pdf deleted' in self.browser.contents)
+
 
 class ContractUITests(CustomersFullSetup):
@@ -305,5 +273,5 @@
     def setup_customizable_params(self):
         self._contract_category = u'riaa'
-        self._document_factory = 'waeup.UnibenCustomerDocument'
+        self._document_factory = 'waeup.UnibenCustomerPDFDocument'
         self._contract_factory = 'waeup.RIAAContract'
         return
Index: main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_document.py
===================================================================
--- main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_document.py	(revision 14190)
+++ main/ikobacustom.uniben/trunk/src/ikobacustom/uniben/customers/tests/test_document.py	(revision 14197)
@@ -29,6 +29,8 @@
 
 from ikobacustom.uniben.testing import (FunctionalLayer, FunctionalTestCase)
-from ikobacustom.uniben.customers.documents import UnibenCustomerDocument
-from ikobacustom.uniben.customers.interfaces import IUnibenCustomerDocument
+from ikobacustom.uniben.customers.documents import (
+    UnibenCustomerPDFDocument, UnibenCustomerJPGDocument)
+from ikobacustom.uniben.customers.interfaces import (
+    IUnibenCustomerPDFDocument, IUnibenCustomerJPGDocument)
 
 
@@ -38,17 +40,27 @@
 
     def test_interfaces(self):
-        verify.verifyClass(IUnibenCustomerDocument, UnibenCustomerDocument)
-        verify.verifyClass(ICustomerNavigation, UnibenCustomerDocument)
-        verify.verifyObject(IUnibenCustomerDocument, UnibenCustomerDocument())
-        verify.verifyObject(ICustomerNavigation, UnibenCustomerDocument())
+        verify.verifyClass(IUnibenCustomerPDFDocument, UnibenCustomerPDFDocument)
+        verify.verifyClass(ICustomerNavigation, UnibenCustomerPDFDocument)
+        verify.verifyObject(IUnibenCustomerPDFDocument, UnibenCustomerPDFDocument())
+        verify.verifyObject(ICustomerNavigation, UnibenCustomerPDFDocument())
+        verify.verifyClass(IUnibenCustomerJPGDocument, UnibenCustomerJPGDocument)
+        verify.verifyClass(ICustomerNavigation, UnibenCustomerJPGDocument)
+        verify.verifyObject(IUnibenCustomerJPGDocument, UnibenCustomerJPGDocument())
+        verify.verifyObject(ICustomerNavigation, UnibenCustomerJPGDocument())
         return
 
     def test_addDocument(self):
         container = CustomerDocumentsContainer()
-        document = createObject(u'waeup.UnibenCustomerDocument')
+        document = createObject(u'waeup.UnibenCustomerPDFDocument')
         id = document.document_id
         container.addDocument(document)
         self.assertEqual(container[id], document)
         self.assertRaises(TypeError, container.addDocument, object())
-        self.assertEqual(document.class_name, 'UnibenCustomerDocument')
+        self.assertEqual(document.class_name, 'UnibenCustomerPDFDocument')
+        document2 = createObject(u'waeup.UnibenCustomerJPGDocument')
+        id = document2.document_id
+        container.addDocument(document2)
+        self.assertEqual(container[id], document2)
+        self.assertRaises(TypeError, container.addDocument, object())
+        self.assertEqual(document2.class_name, 'UnibenCustomerJPGDocument')
         return
