Ignore:
Timestamp:
Sep 13, 2010 3:59:31 PM (14 years ago)
Author:
mylan
Message:

#195: Added captcha field validation test in doctests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.formlib.captcha/trunk/quintagroup/formlib/captcha/tests/test_doctests.py

    r2801 r2806  
    1010from Products.PloneTestCase.layer import PloneSite 
    1111from Testing import ZopeTestCase as ztc 
     12 
     13from quintagroup.captcha.core.utils import * 
     14from quintagroup.captcha.core.tests.base import testPatch 
     15from quintagroup.captcha.core.tests.testWidget import addTestLayer 
    1216 
    1317class FormlibCaptchaLayer(PloneSite): 
     
    2832ptc.setupPloneSite(extension_profiles=['quintagroup.captcha.core:default',]) 
    2933 
    30  
    3134class FormlibCaptchaTestCase(ptc.FunctionalTestCase): 
    3235    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 
    3348 
    3449def test_suite(): 
Note: See TracChangeset for help on using the changeset viewer.