Changeset 7294 for main/waeup.sirp/trunk
- Timestamp:
- 6 Dec 2011, 22:33:31 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/browser/tests/test_captcha.py
r7291 r7294 63 63 return 64 64 65 class NullCaptchaTests(FunctionalTestCase): 66 67 layer = FunctionalLayer 65 class CaptchaTestBase(object): 68 66 69 67 def test_ifaces(self): 70 68 # make sure we implement the promised interfaces 71 obj = NullCaptcha()72 verify.verifyClass(ICaptcha, NullCaptcha)69 obj = self.factory() 70 verify.verifyClass(ICaptcha, self.factory) 73 71 verify.verifyObject(ICaptcha, obj) 74 72 return 73 74 def test_utility(self): 75 # the null captcha is also registered as a utility for ICaptcha 76 captcha = getUtility(ICaptcha, name=self.name) 77 self.assertTrue(isinstance(captcha, self.factory)) 78 return 79 80 class NullCaptchaTests(FunctionalTestCase, CaptchaTestBase): 81 82 layer = FunctionalLayer 83 84 factory = NullCaptcha 85 name = 'No captcha' 75 86 76 87 def test_verify(self): 77 88 # null captchas accept any input request 78 captcha = NullCaptcha()89 captcha = self.factory() 79 90 result1 = captcha.verify(CaptchaRequest('my-sol', 'my-challenge')) 80 91 result2 = captcha.verify(CaptchaRequest(None, None)) … … 85 96 def test_display(self): 86 97 # null captchas do not generate additional HTML code 87 captcha = NullCaptcha()98 captcha = self.factory() 88 99 result = captcha.display() 89 100 self.assertEqual(result, u'') 90 101 return 91 102 92 def test_utility(self): 93 # the null captcha is also registered as a utility for ICaptcha 94 captcha = getUtility(ICaptcha, name='No captcha') 95 self.assertTrue(isinstance(captcha, NullCaptcha)) 96 return 103 class TestCaptchaTests(FunctionalTestCase): 104 105 layer = FunctionalLayer 97 106 98 107 class CaptchaChooserTests(FunctionalTestCase): 99 108 # These tests do not require a site setup 109 # See testsuite below for insite tests. 100 110 101 111 layer = FunctionalLayer
Note: See TracChangeset for help on using the changeset viewer.