Changeset 672
- Timestamp:
- 11/30/06 09:23:51
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneCaptchas/trunk/skins/plone_captchas/prefs_captchas_setup_form.cpt
r671 r672 55 55 </fieldset> 56 56 57 <fieldset> 58 <legend i18n:translate="legend_setup_options">captcha image setup options</legend> 59 <div tal:define="ct here/getCaptchaType;"> 60 <input name="static_captchas" 61 id="use_static_captchas" 62 type="radio" 63 value="static" 64 tal:attributes="checked python:test(ct=='static', 'checked', '')"/> 65 <label for="use_static_captchas">Use static captchas</label> 66 <br /> 67 <input name="static_captchas" 68 id="use_dynamic_captchas" 69 type="radio" 70 disabled="" 71 value="dynamic" 72 tal:attributes="checked python:test(ct=='dynamic', 'checked', ''); 73 disabled python:test(context.checkPIL(), '', 'disabled');"/> 74 <label for="use_dynamic_captchas">Use dynamic captchas</label> 75 </div> 76 </fieldset> 77 57 78 <div class="formControls"> 58 79 <input type="hidden" name="form.submitted" value="1" /> qPloneCaptchas/trunk/tests/testCaptchaWidget.py
r671 r672 31 31 newSecurityManager(None, user) 32 32 self.captcha_key = self.portal.captcha_key 33 33 34 def testImage(self): 35 path = '%s/discussion_reply_form'%self.absolute_url 36 resp1 = self.publish(path, self.basic_auth, request_method='GET').getBody() 37 patt = re.compile('<img\s+src="%s(/getCaptchaImage/[0-9a-fA-F]+)"'%self.portal.absolute_url()) 38 match_obj = patt.search(resp1) 39 img_url = match_obj.group(1) 40 content_type = self.publish('/plone'+img_url, self.basic_auth).getHeader('content-type') 41 self.assert_(content_type.startswith('image')) 42 34 43 def testSubmitRightCaptcha(self): 35 44 hashkey = self.portal.getCaptcha() … … 47 56 self.assert_(not match_obj) 48 57 49 50 51 58 def testSubmitWrongCaptcha(self): 52 59 hashkey = self.portal.getCaptcha() … … 62 69 match_obj = patt.search(response) 63 70 self.assert_(match_obj) 64 71 65 72 def testSubmitRightCaptchaTwice(self): 66 73 hashkey = self.portal.getCaptcha() … … 78 85 match_obj = patt.match(response) 79 86 self.assert_(not match_obj) 80 87 81 88 class TestInstallation(PloneTestCase.FunctionalTestCase): 82 89 … … 84 91 self.loginAsPortalOwner() 85 92 self.addProduct('qPloneCaptchas') 86 93 87 94 def testCaptchaKey(self): 88 95 ck = getattr(self.portal, 'captcha_key') 89 96 self.assert_(ck) 90 97 self.assertEqual(len(ck), 8) 91 98 92 99 def testCaptchaTool(self): 93 100 self.assert_('portal_captchas' in self.portal.objectIds()) 94 101 95 102 96 103 def test_suite():
