Changeset 2019 in products for quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testWidget.py
- Timestamp:
- Mar 29, 2010 12:40:45 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testWidget.py
r1991 r2019 7 7 8 8 NOT_VALID = re.compile("Please re\-enter validation code") 9 IMAGE_PATT = '\s+src="%s(/getCaptchaImage/[0-9a-fA-F]+)"' 9 10 10 11 # patch to use test images and dictionary 11 12 testPatch() 12 13 14 def addTestLayer(self): 15 # Install test_captcha skin layer 16 registerDirectory('tests', GLOBALS) 17 skins = self.portal.portal_skins 18 addDirectoryViews(skins, 'tests', GLOBALS) 19 skinName = skins.getDefaultSkin() 20 paths = map(string.strip, skins.getSkinPath(skinName).split(',')) 21 paths.insert(paths.index('custom')+1, 'test_captcha') 22 skins.addSkinSelection(skinName, ','.join(paths)) 23 self._refreshSkinData() 24 25 13 26 class TestCaptchaWidget(ptc.FunctionalTestCase): 14 15 def addTestLayer(self):16 # Install test_captcha skin layer17 registerDirectory('tests', GLOBALS)18 skins = self.portal.portal_skins19 addDirectoryViews(skins, 'tests', GLOBALS)20 skinName = skins.getDefaultSkin()21 paths = map(string.strip, skins.getSkinPath(skinName).split(','))22 paths.insert(paths.index('custom')+1, 'test_captcha')23 skins.addSkinSelection(skinName, ','.join(paths))24 self._refreshSkinData()25 27 26 28 def afterSetUp(self): 27 29 self.loginAsPortalOwner() 28 30 self.addProduct(PRODUCT_NAME) 29 self.addTestLayer()31 addTestLayer(self) 30 32 self.portal.invokeFactory('Document', 'index_html') 31 33 self.portal['index_html'].allowDiscussion(True) … … 38 40 path = '%s/test_form' % self.absolute_url 39 41 response = self.publish(path, self.basic_auth, request_method='GET').getBody() 40 patt = re.compile( '\s+src="%s(/getCaptchaImage/[0-9a-fA-F]+)"'% self.portal.absolute_url())42 patt = re.compile(IMAGE_PATT % self.portal.absolute_url()) 41 43 match_obj = patt.search(response) 42 44
Note: See TracChangeset
for help on using the changeset viewer.