Changeset 7295 for main/waeup.sirp/trunk/src/waeup/sirp/browser/tests
- Timestamp:
- 7 Dec 2011, 00:12:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/tests/test_captcha.py
r7294 r7295 25 25 ICaptchaResponse, ICaptchaRequest, ICaptcha, ICaptchaChooser) 26 26 from waeup.sirp.browser.captcha import ( 27 CaptchaResponse, CaptchaRequest, NullCaptcha, CaptchaChooser)27 CaptchaResponse, CaptchaRequest, NullCaptcha, IdCaptcha, CaptchaChooser) 28 28 29 29 class CaptchaResponseTests(FunctionalTestCase): … … 101 101 return 102 102 103 class TestCaptchaTests(FunctionalTestCase): 104 105 layer = FunctionalLayer 103 class IdCaptchaTests(FunctionalTestCase, CaptchaTestBase): 104 105 layer = FunctionalLayer 106 107 factory = IdCaptcha 108 name = 'Testing captcha' 109 110 def test_verify(self): 111 # id captchas accept any solution that matches challenge and 112 # is not empty or None 113 captcha = self.factory() 114 result1 = captcha.verify(CaptchaRequest('my-sol', 'my-challenge')) 115 result2 = captcha.verify(CaptchaRequest(None, None)) 116 result3 = captcha.verify(CaptchaRequest('', '')) 117 result4 = captcha.verify(CaptchaRequest('my-sol', 'my-sol')) 118 self.assertEqual(result1.is_valid, False) 119 self.assertEqual(result2.is_valid, False) 120 self.assertEqual(result3.is_valid, False) 121 self.assertEqual(result4.is_valid, True) 122 return 123 124 def test_display(self): 125 # id captchas provide a simple HTML input 126 captcha = self.factory() 127 result = captcha.display() 128 self.assertMatches( 129 '<input type="hidden" name="challenge"' 130 ' value="..." /><br />Type: ...<br />' 131 '<input type="text" name="solution" /><br />', 132 result) 133 return 134 106 135 107 136 class CaptchaChooserTests(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.