Changeset 12927 for main/waeup.kofa/trunk
- Timestamp:
- 13 May 2015, 06:17:58 (10 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/docs/source/userdocs/testing.rst
r12926 r12927 143 143 144 144 145 Pythontests 146 =========== 145 Python Tests 146 ============ 147 148 .. literalinclude:: ../../../src/waeup/kofa/browser/tests/test_browser.py 149 :pyobject: SupplementaryBrowserTests.test_suspended_officer 150 -
main/waeup.kofa/trunk/src/waeup/kofa/browser/tests/test_browser.py
r12926 r12927 39 39 40 40 class 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 """ 42 43 43 44 layer = FunctionalLayer … … 104 105 105 106 class DataCenterUITests(UniversitySetup): 106 # Tests for DataCenter class views and pages 107 """Tests for DataCenter class views and pages. 108 """ 107 109 108 110 layer = FunctionalLayer … … 167 169 168 170 class DataCenterUIExportTests(UniversitySetup, FunctionalAsyncTestCase): 169 # Tests for DataCenter class views and pages 171 """Tests for DataCenter class views and pages. 172 """ 170 173 171 174 layer = FunctionalLayer … … 407 410 408 411 class SupplementaryBrowserTests(UniversitySetup): 409 # These are additional tests to browser.txt 412 """These are additional tests to browser.txt 413 """ 410 414 411 415 def test_set_former_course(self): … … 448 452 def test_suspended_officer(self): 449 453 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. 452 456 self.app['users']['officer'].password = None 453 457 self.browser.open('http://localhost/app/login') … … 457 461 self.assertTrue( 458 462 'You entered invalid credentials.' in self.browser.contents) 459 # We set the password again 463 # We set the password again. 460 464 IUserAccount( 461 465 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. 463 467 self.app['users']['officer'].suspended = True 464 468 self.browser.open('http://localhost/app/login') … … 469 473 '...but yor account has been temporarily deactivated...', 470 474 self.browser.contents) 475 # Officer is really not logged in. 471 476 self.assertFalse("Bob Officer" in self.browser.contents) 472 477 self.app['users']['officer'].suspended = False … … 475 480 self.browser.getControl(name="form.password").value = 'secret' 476 481 self.browser.getControl("Login").click() 482 # Yeah, office logged in. 477 483 self.assertMatches( 478 484 '...You logged in...', self.browser.contents) 479 485 self.assertTrue("Bob Officer" in self.browser.contents) 480 486 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. 483 490 self.browser.open('http://localhost/app/users') 484 491 self.assertFalse('(suspended)' in self.browser.contents) … … 488 495 '<span style="color:red">(suspended)</span>' 489 496 in self.browser.contents) 497 # A flash message appears on the edit page of the officer. 490 498 self.browser.open('http://localhost/app/users/officer') 491 499 self.assertTrue(
Note: See TracChangeset for help on using the changeset viewer.