Ignore:
Timestamp:
13 May 2015, 06:17:58 (10 years ago)
Author:
Henrik Bettermann
Message:

Include code example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py

    r12926 r12927  
    3939
    4040class UniversitySetup(FunctionalTestCase):
    41     # A test case that only contains a setup and teardown
     41    """A test case that only contains a setup and teardown.
     42    """
    4243
    4344    layer = FunctionalLayer
     
    104105
    105106class DataCenterUITests(UniversitySetup):
    106     # Tests for DataCenter class views and pages
     107    """Tests for DataCenter class views and pages.
     108    """
    107109
    108110    layer = FunctionalLayer
     
    167169
    168170class DataCenterUIExportTests(UniversitySetup, FunctionalAsyncTestCase):
    169     # Tests for DataCenter class views and pages
     171    """Tests for DataCenter class views and pages.
     172    """
    170173
    171174    layer = FunctionalLayer
     
    407410
    408411class SupplementaryBrowserTests(UniversitySetup):
    409     # These are additional tests to browser.txt
     412    """These are additional tests to browser.txt
     413    """
    410414
    411415    def test_set_former_course(self):
     
    448452    def test_suspended_officer(self):
    449453        self.app['users'].addUser(
    450             'officer', 'secret', title='Bob Officer', email='aa@aa.ng')
    451         # Officer can't login if their password is not set
     454            'officer', 'secret', title='Bob Officer', email='bob@abcd.ng')
     455        # Officer can't login if their password is not set.
    452456        self.app['users']['officer'].password = None
    453457        self.browser.open('http://localhost/app/login')
     
    457461        self.assertTrue(
    458462            'You entered invalid credentials.' in self.browser.contents)
    459         # We set the password again
     463        # We set the password again.
    460464        IUserAccount(
    461465            self.app['users']['officer']).setPassword('secret')
    462         # Officers can't login if their account is suspended/deactivated
     466        # Officers can't login if their account is suspended/deactivated.
    463467        self.app['users']['officer'].suspended = True
    464468        self.browser.open('http://localhost/app/login')
     
    469473            '...but yor account has been temporarily deactivated...',
    470474            self.browser.contents)
     475        # Officer is really not logged in.
    471476        self.assertFalse("Bob Officer" in self.browser.contents)
    472477        self.app['users']['officer'].suspended = False
     
    475480        self.browser.getControl(name="form.password").value = 'secret'
    476481        self.browser.getControl("Login").click()
     482        # Yeah, office logged in.
    477483        self.assertMatches(
    478484            '...You logged in...', self.browser.contents)
    479485        self.assertTrue("Bob Officer" in self.browser.contents)
    480486        self.browser.getLink("Logout").click()
    481         # Suspended accounts are marked
    482         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     487        # Login as manager.
     488        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     489        # Suspended accounts are marked in red.
    483490        self.browser.open('http://localhost/app/users')
    484491        self.assertFalse('(suspended)' in self.browser.contents)
     
    488495            '<span style="color:red">(suspended)</span>'
    489496            in self.browser.contents)
     497        # A flash message appears on the edit page of the officer.
    490498        self.browser.open('http://localhost/app/users/officer')
    491499        self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.