Changeset 12040 for main


Ignore:
Timestamp:
23 Nov 2014, 17:07:44 (10 years ago)
Author:
Henrik Bettermann
Message:

Add test.

File:
1 edited

Legend:

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

    r12039 r12040  
    665665        self.assertTrue('An email with' in self.browser.contents)
    666666
    667 class CustomerRequestPWTests(CustomersFullSetup):
     667class CustomerRegistrationTests(CustomersFullSetup):
    668668    # Tests for customer registration
    669669
     
    718718        return
    719719
     720    def test_create_account(self):
     721        # Customer with wrong number can't be found.
     722        self.browser.open('http://localhost/app/createaccount')
     723        self.browser.getControl(name="form.firstname").value = 'Ruben'
     724        self.browser.getControl(name="form.lastname").value = 'Gonzales'
     725        self.browser.getControl(name="form.email").value = 'newcustomer@xx.zz'
     726        self.browser.getControl("Send login credentials").click()
     727        self.assertTrue('Your request was successful.'
     728            in self.browser.contents)
     729        # ... and  customer can be found in the catalog via the email address
     730        cat = queryUtility(ICatalog, name='customers_catalog')
     731        results = list(
     732            cat.searchResults(
     733            email=('newcustomer@xx.zz', 'newcustomer@xx.zz')))
     734        self.assertEqual(self.app['customers']['K1000001'], results[0])
     735        self.assertEqual(self.app['customers']['K1000001'].firstname, 'Ruben')
     736        self.assertEqual(self.app['customers']['K1000001'].lastname, 'Gonzales')
     737        logfile = os.path.join(
     738            self.app['datacenter'].storage, 'logs', 'main.log')
     739        logcontent = open(logfile).read()
     740        self.assertTrue('zope.anybody - customers.browser.CustomerCreateAccountPage - '
     741                        'K1000001 - newcustomer@xx.zz' in logcontent)
     742        return
     743
    720744class CustomerDataExportTests(CustomersFullSetup, FunctionalAsyncTestCase):
    721745    # Tests for CustomersContainer class views and pages
Note: See TracChangeset for help on using the changeset viewer.