Changeset 3121 in products for quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests
- Timestamp:
- Apr 15, 2011 1:00:00 PM (13 years ago)
- Location:
- quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests/test_doctests.py
r2806 r3121 15 15 from quintagroup.captcha.core.tests.testWidget import addTestLayer 16 16 17 17 18 class FormlibCaptchaLayer(PloneSite): 18 19 @classmethod … … 29 30 def tearDown(cls): 30 31 pass 31 32 ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default',]) 32 33 ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default', ]) 34 33 35 34 36 class FormlibCaptchaTestCase(ptc.FunctionalTestCase): … … 44 46 self.hashkey = self.portal.getCaptcha() 45 47 decrypted = decrypt(captcha_key, self.hashkey) 46 self.captcha_word = getWord(int(parseKey(decrypted)['key']) -1)48 self.captcha_word = getWord(int(parseKey(decrypted)['key']) - 1) 47 49 48 50 … … 54 56 'README.txt', package='quintagroup.formlib.captcha', 55 57 test_class=FormlibCaptchaTestCase, 56 optionflags=doctest.REPORT_ONLY_FIRST_FAILURE | doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS),57 58 optionflags=doctest.REPORT_ONLY_FIRST_FAILURE | \ 59 doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS), 58 60 ]) 59 61 -
quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests/test_unittests.py
r2800 r3121 21 21 from quintagroup.formlib.captcha import CaptchaWidget 22 22 23 23 24 @onsetup 24 25 def setup_product(): … … 31 32 32 33 setup_product() 33 ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default', ])34 ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default', ]) 34 35 35 36 … … 79 80 FIELDTAG = '<input\s+[^>]*type=\"text\"\s*[^>]*>' 80 81 self.assertEqual(re.search(FIELDTAG, self.html) is not None, True) 81 82 82 83 83 84 class TestCaptchaWidgetToField(ptc.PloneTestCase): … … 101 102 def testSubmitRightCaptcha(self): 102 103 decrypted = decrypt(self.captcha_key, self.hashkey) 103 key = getWord(int(parseKey(decrypted)['key']) -1)104 key = getWord(int(parseKey(decrypted)['key']) - 1) 104 105 try: 105 106 res = self.widget._toFieldValue(key) 106 107 except ConversionError, e: 107 self.fail("Rised unexpected %s error on right captcha submit" % e.doc()) 108 self.fail("Rised unexpected %s error on right captcha submit" % \ 109 e.doc()) 108 110 else: 109 111 self.assertEqual(res, key) 110 112 111 113 def testSubmitWrongCaptcha(self): 112 114 try: … … 119 121 def testSubmitRightCaptchaTwice(self): 120 122 decrypted = decrypt(self.captcha_key, self.hashkey) 121 key = getWord(int(parseKey(decrypted)['key']) -1)123 key = getWord(int(parseKey(decrypted)['key']) - 1) 122 124 self.widget._toFieldValue(key) 123 125 try:
Note: See TracChangeset
for help on using the changeset viewer.