Changeset 1975 in products
- Timestamp:
- Mar 22, 2010 8:31:15 PM (14 years ago)
- Location:
- quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests
- Files:
-
- 10 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/base.py
r1957 r1975 13 13 from Products.PloneTestCase.PloneTestCase import default_password 14 14 15 from Products.CMFCore.utils import getToolByName16 17 15 from quintagroup.captcha.core.config import * 18 16 from quintagroup.captcha.core.utils import getWord, decrypt, parseKey 17 18 # PATCH dictionary for captcha testing 19 from Products.CMFCore.utils import getToolByName 20 class TestData(object): 21 words = """heart 22 glass 23 blue 24 false 25 burn 26 """ 27 28 from quintagroup.captcha.core import utils 29 utils.basic_english = TestData() 30 utils.CAPTCHAS_COUNT = len(utils.basic_english.words.split()) 31 # END OF PATCH 19 32 20 33 @onsetup -
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testWidget.py
r1957 r1975 44 44 def testSubmitRightCaptcha(self): 45 45 hashkey = self.portal.getCaptcha() 46 key = getWord(int(parseKey(decrypt(self.captcha_key, hashkey))['key'])) 46 # index of word number starts from 1, but index of dictionary starts from 0 47 key = getWord(int(parseKey(decrypt(self.captcha_key, hashkey))['key'])-1 ) 47 48 parameters = 'form.submitted=1&key=%s' % key 48 49 path = '%s/test_form?%s' % (self.absolute_url, parameters) … … 50 51 'form.button.Save': 'Save'} 51 52 response = self.publish(path, self.basic_auth, extra=extra, request_method='GET').getBody() 52 53 open('/tmp/right.captcha.html','w').write(response)54 55 53 self.assert_(not NOT_VALID.search(response)) 56 54 … … 66 64 def testSubmitRightCaptchaTwice(self): 67 65 hashkey = self.portal.getCaptcha() 68 key = getWord(int(parseKey(decrypt(self.captcha_key, hashkey))['key']) )66 key = getWord(int(parseKey(decrypt(self.captcha_key, hashkey))['key'])-1) 69 67 parameters = 'form.submitted=1&key=%s'%key 70 68 path = '%s/test_form?%s'%(self.absolute_url, parameters)
Note: See TracChangeset
for help on using the changeset viewer.