Ignore:
Timestamp:
26 Nov 2014, 13:03:56 (10 years ago)
Author:
Henrik Bettermann
Message:

Add PDFDocumentSlipPage and related components.

File:
1 edited

Legend:

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

    r12059 r12062  
    893893        # Costumer can upload a document.
    894894        self.browser.getLink("Edit").click()
    895         ctrl = self.browser.getControl(name='sampleeditupload')
     895        ctrl = self.browser.getControl(name='samplescaneditupload')
    896896        file_obj = open(SAMPLE_IMAGE, 'rb')
    897897        file_ctrl = ctrl.mech_control
    898898        file_ctrl.add_file(file_obj, filename='my_document.jpg')
    899899        self.browser.getControl(
    900             name='upload_sampleeditupload').click()
     900            name='upload_samplescaneditupload').click()
    901901        self.assertTrue(
    902902            'href="http://localhost/app/customers/K1000000/documents/d102/sample"'
     
    919919        # Create a pseudo image file and select it to be uploaded
    920920        image = open(SAMPLE_IMAGE, 'rb')
    921         ctrl = self.browser.getControl(name='samplemanageupload')
     921        ctrl = self.browser.getControl(name='samplescanmanageupload')
    922922        file_ctrl = ctrl.mech_control
    923923        file_ctrl.add_file(image, filename='my_sample_scan.jpg')
     
    929929        # ... but the correct upload submit button does
    930930        image = open(SAMPLE_IMAGE)
    931         ctrl = self.browser.getControl(name='samplemanageupload')
     931        ctrl = self.browser.getControl(name='samplescanmanageupload')
    932932        file_ctrl = ctrl.mech_control
    933933        file_ctrl.add_file(image, filename='my_sample_scan.jpg')
    934934        self.browser.getControl(
    935             name='upload_samplemanageupload').click()
     935            name='upload_samplescanmanageupload').click()
    936936        self.assertTrue(
    937937            'href="http://localhost/app/customers/K1000000/documents/d101/sample"'
     
    945945        self.browser.open(self.customer_path + '/documents/d101/manage')
    946946        self.assertFalse(
    947             'upload_samplemanageupload' in self.browser.contents)
     947            'upload_samplescanmanageupload' in self.browser.contents)
    948948        # File must be deleted first
    949         self.browser.getControl(name='delete_samplemanageupload').click()
     949        self.browser.getControl(name='delete_samplescanmanageupload').click()
    950950        self.assertTrue(
    951951            'sample deleted' in self.browser.contents)
    952952        # Uploading a file which is bigger than 150k will raise an error
    953953        big_image = StringIO(open(SAMPLE_IMAGE, 'rb').read() * 75)
    954         ctrl = self.browser.getControl(name='samplemanageupload')
     954        ctrl = self.browser.getControl(name='samplescanmanageupload')
    955955        file_ctrl = ctrl.mech_control
    956956        file_ctrl.add_file(big_image, filename='my_sample_scan.jpg')
    957957        self.browser.getControl(
    958             name='upload_samplemanageupload').click()
     958            name='upload_samplescanmanageupload').click()
    959959        self.assertTrue(
    960960            'Uploaded file is too big' in self.browser.contents)
    961961        # we do not rely on filename extensions given by uploaders
    962962        image = open(SAMPLE_IMAGE, 'rb') # a jpg-file
    963         ctrl = self.browser.getControl(name='samplemanageupload')
     963        ctrl = self.browser.getControl(name='samplescanmanageupload')
    964964        file_ctrl = ctrl.mech_control
    965965        # tell uploaded file is bmp
    966966        file_ctrl.add_file(image, filename='my_sample_scan.bmp')
    967967        self.browser.getControl(
    968             name='upload_samplemanageupload').click()
     968            name='upload_samplescanmanageupload').click()
    969969        self.assertTrue(
    970970            # jpg file was recognized
    971971            'File sample.jpg uploaded.' in self.browser.contents)
    972972        # Delete file again
    973         self.browser.getControl(name='delete_samplemanageupload').click()
     973        self.browser.getControl(name='delete_samplescanmanageupload').click()
    974974        self.assertTrue(
    975975            'sample deleted' in self.browser.contents)
    976976        # File names must meet several conditions
    977977        bmp_image = open(SAMPLE_IMAGE_BMP, 'rb')
    978         ctrl = self.browser.getControl(name='samplemanageupload')
     978        ctrl = self.browser.getControl(name='samplescanmanageupload')
    979979        file_ctrl = ctrl.mech_control
    980980        file_ctrl.add_file(bmp_image, filename='my_sample_scan.bmp')
    981981        self.browser.getControl(
    982             name='upload_samplemanageupload').click()
     982            name='upload_samplescanmanageupload').click()
    983983        self.assertTrue('Only the following extensions are allowed'
    984984            in self.browser.contents)
     
    995995        # Create a pseudo image file and select it to be uploaded
    996996        image = open(SAMPLE_IMAGE, 'rb')
    997         ctrl = self.browser.getControl(name='pdfmanageupload')
     997        ctrl = self.browser.getControl(name='pdfscanmanageupload')
    998998        file_ctrl = ctrl.mech_control
    999999        file_ctrl.add_file(image, filename='my_sample_scan.jpg')
    10001000        self.browser.getControl(
    1001             name='upload_pdfmanageupload').click()
     1001            name='upload_pdfscanmanageupload').click()
    10021002        self.assertTrue(
    10031003            'pdf file extension expected' in self.browser.contents)
    1004         ctrl = self.browser.getControl(name='pdfmanageupload')
     1004        ctrl = self.browser.getControl(name='pdfscanmanageupload')
    10051005        file_ctrl = ctrl.mech_control
    10061006        file_ctrl.add_file(image, filename='my_sample_scan.pdf')
    10071007        self.browser.getControl(
    1008             name='upload_pdfmanageupload').click()
     1008            name='upload_pdfscanmanageupload').click()
    10091009        self.assertTrue(
    10101010            'Could not determine file type' in self.browser.contents)
    10111011        pdf = open(SAMPLE_PDF, 'rb')
    1012         ctrl = self.browser.getControl(name='pdfmanageupload')
     1012        ctrl = self.browser.getControl(name='pdfscanmanageupload')
    10131013        file_ctrl = ctrl.mech_control
    10141014        file_ctrl.add_file(pdf, filename='my_sample_scan.pdf')
    10151015        self.browser.getControl(
    1016             name='upload_pdfmanageupload').click()
     1016            name='upload_pdfscanmanageupload').click()
    10171017        self.assertTrue(
    10181018            'href="http://localhost/app/customers/K1000000/documents/d102/sample.pdf">PDF File</a>'
     
    10251025    def test_view_slips(self):
    10261026        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    1027         # Officers can open the pdf transcript
     1027        # Officers can open the document overview
    10281028        self.browser.open(self.customer_path + '/documents')
    10291029        self.browser.getLink("Download documents overview").click()
     
    10331033        open(path, 'wb').write(self.browser.contents)
    10341034        print "Sample PDF overview_slip.pdf written to %s" % path
     1035        # Officers can open document slips
     1036        self.browser.open(self.customer_path + '/documents/d101')
     1037        self.browser.getLink("Download document slip").click()
     1038        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     1039        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     1040        path = os.path.join(samples_dir(), 'document_slip.pdf')
     1041        open(path, 'wb').write(self.browser.contents)
     1042        print "Sample document_slip.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.