Changeset 2806 in products for quintagroup.formlib.captcha
- Timestamp:
- Sep 13, 2010 3:59:31 PM (14 years ago)
- Location:
- quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/README.txt
r2805 r2806 50 50 True 51 51 52 53 Now try to submit form with wrong captcha key. Error status message will 54 be shown. 55 56 >>> browser.open(self.portal.absolute_url() + '/@@formlib-captcha-form') 57 >>> browser.getControl(name='form.captcha').value = "wrong captcha" 58 >>> browser.getControl(name='form..hashkey').value = self.hashkey 59 >>> browser.getControl(name="form.actions.save").click() 60 >>> "Type the code" in browser.contents 61 True 62 >>> "Please re-enter validation code." in browser.contents 63 True 64 65 And now submit form with correct captcha key. 66 67 >>> browser.open(self.portal.absolute_url() + '/@@formlib-captcha-form') 68 >>> browser.getControl(name='form.captcha').value = self.captcha_word 69 >>> browser.getControl(name='form..hashkey').value = self.hashkey 70 >>> browser.getControl(name="form.actions.save").click() 71 >>> "Please re-enter validation code." in browser.contents 72 False 73 74 No error shown. -
quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests/test_doctests.py
r2801 r2806 10 10 from Products.PloneTestCase.layer import PloneSite 11 11 from Testing import ZopeTestCase as ztc 12 13 from quintagroup.captcha.core.utils import * 14 from quintagroup.captcha.core.tests.base import testPatch 15 from quintagroup.captcha.core.tests.testWidget import addTestLayer 12 16 13 17 class FormlibCaptchaLayer(PloneSite): … … 28 32 ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default',]) 29 33 30 31 34 class FormlibCaptchaTestCase(ptc.FunctionalTestCase): 32 35 layer = FormlibCaptchaLayer 36 37 def afterSetUp(self): 38 # prepare context 39 self.loginAsPortalOwner() 40 testPatch() 41 addTestLayer(self) 42 # prepare captcha data 43 captcha_key = self.portal.captcha_key 44 self.hashkey = self.portal.getCaptcha() 45 decrypted = decrypt(captcha_key, self.hashkey) 46 self.captcha_word = getWord(int(parseKey(decrypted)['key'])-1 ) 47 33 48 34 49 def test_suite():
Note: See TracChangeset
for help on using the changeset viewer.