Changeset 11974


Ignore:
Timestamp:
16 Nov 2014, 22:43:21 (10 years ago)
Author:
Henrik Bettermann
Message:

Add activate/deactivate test.

File:
1 edited

Legend:

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

    r11973 r11974  
    416416        return
    417417
    418 
    419 
     418    def test_activate_deactivate_buttons(self):
     419        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     420        self.browser.open(self.customer_path)
     421        self.browser.getLink("Deactivate").click()
     422        self.assertTrue(
     423            'Customer account has been deactivated.' in self.browser.contents)
     424        self.assertTrue(
     425            'Base Data (account deactivated)' in self.browser.contents)
     426        self.assertTrue(self.customer.suspended)
     427        self.browser.getLink("Activate").click()
     428        self.assertTrue(
     429            'Customer account has been activated.' in self.browser.contents)
     430        self.assertFalse(
     431            'Base Data (account deactivated)' in self.browser.contents)
     432        self.assertFalse(self.customer.suspended)
     433        # History messages have been added ...
     434        self.browser.getLink("History").click()
     435        self.assertTrue(
     436            'Customer account deactivated by Manager<br />' in self.browser.contents)
     437        self.assertTrue(
     438            'Customer account activated by Manager<br />' in self.browser.contents)
     439        # ... and actions have been logged.
     440        logfile = os.path.join(
     441            self.app['datacenter'].storage, 'logs', 'customers.log')
     442        logcontent = open(logfile).read()
     443        self.assertTrue('zope.mgr - customers.browser.CustomerDeactivatePage - '
     444                        'K1000000 - account deactivated' in logcontent)
     445        self.assertTrue('zope.mgr - customers.browser.CustomerActivatePage - '
     446                        'K1000000 - account activated' in logcontent)
     447
Note: See TracChangeset for help on using the changeset viewer.