Ignore:
Timestamp:
20 Nov 2014, 21:39:40 (10 years ago)
Author:
Henrik Bettermann
Message:

Add first browser components with tests.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests
Files:
2 edited

Legend:

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

    r11997 r12015  
    1 ## $Id: test_browser.py 11862 2014-10-21 07:07:04Z henrik $
     1## $Id$
    22##
    33## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
     
    101101        self.customer_id = customer.customer_id
    102102        self.customer = self.app['customers'][self.customer_id]
     103        document = createObject('waeup.CustomerDocument')
     104        document.title = u'My first document'
     105        self.customer['documents'].addDocument(document)
    103106
    104107        # Set password
     
    114117        self.trigtrans_path = self.customer_path + '/trigtrans'
    115118        self.history_path = self.customer_path + '/history'
     119        self.documents_path = self.customer_path + '/documents'
    116120
    117121        self.app['configuration'].carry_over = True
     
    766770            'job_id=%s' % job_id in logcontent
    767771            )
     772
     773
     774class CustomerDocumentUITests(CustomersFullSetup):
     775    # Tests for CustomerDocument relates views and pages
     776
     777    def test_manage_document(self):
     778        # Managers can access the pages of customer documentsconter
     779        # and can perform actions
     780        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     781        self.browser.open(self.customer_path)
     782        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     783        self.assertEqual(self.browser.url, self.customer_path)
     784        self.browser.open(self.customer_path)
     785        self.browser.getLink("Documents").click()
     786        self.browser.getLink("Add document").click()
     787        self.browser.getControl(name="doctype").value = ['generic']
     788        self.browser.getControl("Create document").click()
     789        self.assertTrue('Generic Document created.' in self.browser.contents)
     790        document = self.customer['documents']['d102']
     791
     792        # Documents can be removed
     793        ctrl = self.browser.getControl(name='val_id')
     794        ctrl.getControl(value=document.document_id).selected = True
     795        self.browser.getControl("Remove selected", index=0).click()
     796        self.assertTrue('Successfully removed' in self.browser.contents)
     797
     798        # All actions are being logged
     799        logfile = os.path.join(
     800            self.app['datacenter'].storage, 'logs', 'customers.log')
     801        logcontent = open(logfile).read()
     802
     803        self.assertTrue(
     804            'INFO - zope.mgr - customers.browser.DocumentAddFormPage '
     805            '- K1000000 - added: Generic Document %s'
     806            % document.document_id in logcontent)
     807
     808        self.assertTrue(
     809            'INFO - zope.mgr - customers.browser.DocumentsManageFormPage '
     810            '- K1000000 - removed: %s'
     811            % document.document_id in logcontent)
  • main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_export.py

    r12007 r12015  
    138138        self.assertEqual(
    139139            result,
    140             'doctype,document_id,history,title,customer_id\r\n'
    141             ',d101,[],,\r\n'
     140            'document_id,history,title,customer_id\r\n'
     141            'd101,[],,\r\n'
    142142            )
    143143        return
     
    152152        result = open(self.outfile, 'rb').read()
    153153        self.assertTrue(
    154             'doctype,document_id,history,title,customer_id\r\n'
     154            'document_id,history,title,customer_id\r\n'
    155155            in result
    156156            )
     
    169169        result = open(self.outfile, 'rb').read()
    170170        self.assertTrue(
    171             'doctype,document_id,history,title,customer_id\r\n'
     171            'document_id,history,title,customer_id\r\n'
    172172            in result)
    173173        self.assertTrue(
     
    184184        result = open(self.outfile, 'rb').read()
    185185        self.assertTrue(
    186             'doctype,document_id,history,title,customer_id\r\n'
     186            'document_id,history,title,customer_id\r\n'
    187187            in result)
    188188        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.