Changeset 5906
- Timestamp:
- 31 Mar 2011, 10:10:11 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py
r5895 r5906 26 26 import tempfile 27 27 import unittest 28 from datetime import datetime 28 29 from zope.app.testing.functional import FunctionalTestCase 29 30 from zope.app.testing.functional import HTTPCaller as http … … 37 38 class LoginTest(FunctionalTestCase): 38 39 # Here we check login view of applicants containers. 40 # 41 # Tests in here do only cover login attempts without any PINs 42 # created before. 39 43 40 44 layer = FunctionalLayer … … 119 123 self.assertTrue('666' in self.browser.contents) 120 124 return 125 126 class LoginTestWithPINs(LoginTest): 127 # Here we check login view of applicants containers with PINs provided. 128 129 # As setting up pins is time-consuming we only set them up when 130 # really needed (i.e. in this separate TestCase). 131 132 layer = FunctionalLayer 133 134 def setUp(self): 135 super(LoginTestWithPINs, self).setUp() 136 137 # Create 5 access codes with prefix 'FOO' and cost 9.99 each 138 pin_container = self.getRootFolder()['app']['accesscodes'] 139 pin_container.createBatch( 140 datetime.now(), 'some_userid', 'APP', 9.99, 5) 141 pins = pin_container[pin_container.keys()[0]].entries() 142 self.pins = [x.representation for x in pins] 143 self.existing_pin = self.pins[0] 144 parts = self.existing_pin.split('-')[1:] 145 self.existing_series, self.existing_number = parts 146 self.browser.handleErrors = False 121 147 148 def tearDown(self): 149 super(LoginTestWithPINs, self).tearDown() 150 151 def test_anonymous_valid_login(self): 152 self.browser.open(self.login_path) 153 # Enter some value we can look for after submit 154 ac_series = self.browser.getControl(name="form.ac_series") 155 ac_series.value = self.existing_series 156 ac_number = self.browser.getControl(name="form.ac_number") 157 ac_number.value = self.existing_number 158 self.browser.getControl(name="SUBMIT").click() 159 self.assertEqual(self.browser.contents, 12) 160 self.assertTrue(self.browser.url != self.login_path) 161 162 return 163 164 122 165 def suite(): 123 166 suite = unittest.TestSuite() 124 167 for testcase in [ 125 168 LoginTest, 169 LoginTestWithPINs, 126 170 ]: 127 171 suite.addTests(unittest.makeSuite(testcase))
Note: See TracChangeset for help on using the changeset viewer.