Changeset 3600 in products
- Timestamp:
- Oct 24, 2012 3:05:59 PM (12 years ago)
- Location:
- quintagroup.captcha.core/trunk/quintagroup/captcha/core
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testConfiglet.py
r3144 r3600 37 37 38 38 self.assertTrue(self.layerInSkins(LAYER_STATIC_CAPTCHAS), 39 "No '%s' skin layer in some skins" % LAYER_STATIC_CAPTCHAS) 39 "No '%s' skin layer in some skins" % 40 LAYER_STATIC_CAPTCHAS) 40 41 41 42 def test_dynamicOn(self): … … 44 45 45 46 self.assertTrue(self.layerInSkins(LAYER_DYNAMIC_CAPTCHAS), 46 "No '%s' skin layer in some skins" % LAYER_DYNAMIC_CAPTCHAS) 47 "No '%s' skin layer in some skins" % 48 LAYER_DYNAMIC_CAPTCHAS) 47 49 48 50 def test_imageSize(self): 49 51 expect = 35 50 52 self.publish(self.save_url + '&image_size=%s' % expect, 51 self.basic_auth)53 self.basic_auth) 52 54 53 55 imsize = self.capprops.getProperty("image_size", 0) 54 self.assertTrue(imsize == expect, '"image_size" property ' \55 'contains: "%s", must: "%s"' % (imsize, expect))56 self.assertTrue(imsize == expect, '"image_size" property ' 57 'contains: "%s", must: "%s"' % (imsize, expect)) 56 58 57 59 def test_background(self): 58 60 prop, expect = "background", "test-color" 59 61 self.publish(self.save_url + '&%s=%s' % (prop, expect), 60 self.basic_auth)62 self.basic_auth) 61 63 62 64 fact = self.capprops.getProperty(prop, "") 63 self.assertTrue(fact == expect, '"%s" property ' \64 'contains: "%s", must: "%s"' % (prop, fact, expect))65 self.assertTrue(fact == expect, '"%s" property ' 66 'contains: "%s", must: "%s"' % (prop, fact, expect)) 65 67 66 68 def test_fontColor(self): 67 69 prop, expect = "font_color", "test-font-color" 68 70 self.publish(self.save_url + '&%s=%s' % (prop, expect), 69 self.basic_auth)71 self.basic_auth) 70 72 71 73 fact = self.capprops.getProperty(prop, "") 72 self.assertTrue(fact == expect, '"%s" property ' \73 'contains: "%s", must: "%s"' % (prop, fact, expect))74 self.assertTrue(fact == expect, '"%s" property ' 75 'contains: "%s", must: "%s"' % (prop, fact, expect)) 74 76 75 77 def test_period(self): 76 78 prop, expect = "period", 22.3 77 79 self.publish(self.save_url + '&%s=%s' % (prop, expect), 78 self.basic_auth)80 self.basic_auth) 79 81 80 82 fact = self.capprops.getProperty(prop, 0) 81 self.assertTrue(fact == expect, '"%s" property ' \82 'contains: "%s", must: "%s"' % (prop, fact, expect))83 self.assertTrue(fact == expect, '"%s" property ' 84 'contains: "%s", must: "%s"' % (prop, fact, expect)) 83 85 84 86 def test_amplitude(self): 85 87 prop, expect = "amplitude", 11.2 86 88 self.publish(self.save_url + '&%s=%s' % (prop, expect), 87 self.basic_auth)89 self.basic_auth) 88 90 89 91 fact = self.capprops.getProperty(prop, 0) 90 self.assertTrue(fact == expect, '"%s" property ' \91 'contains: "%s", must: "%s"' % (prop, fact, expect))92 self.assertTrue(fact == expect, '"%s" property ' 93 'contains: "%s", must: "%s"' % (prop, fact, expect)) 92 94 93 95 def test_random(self): … … 96 98 97 99 fact = self.capprops.getProperty(prop, None) 98 self.assertTrue(fact == expect, '"%s" property ' \99 'contains: "%s", must: "%s"' % (prop, fact, expect))100 self.assertTrue(fact == expect, '"%s" property ' 101 'contains: "%s", must: "%s"' % (prop, fact, expect)) 100 102 101 103 … … 118 120 form = re.match(reg_expr, self.view, re.I | re.S) 119 121 self.assertNotEqual(form, None, 120 "No 'Plone Captchas Setup' form present on the configlet view")122 "No 'Plone Captchas Setup' form present on the configlet view") 121 123 self.assertNotEqual(self.matchinput('form\.button\.form_submit'), None, 122 "No submit button on the form")124 "No submit button on the form") 123 125 self.assertNotEqual(self.matchinput('static_captchas'), None, 124 "No static/dynamic radio button present on the configlet")126 "No static/dynamic radio button present on the configlet") 125 127 126 128 def test_dynamic(self): … … 129 131 for param in params: 130 132 self.assertNotEqual(self.matchinput(param), None, 131 "'%s' form element absence on the configlet form" % param)133 "'%s' form element absence on the configlet form" % param) 132 134 133 135 -
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testDynamic.py
r3144 r3600 44 44 def testPILImageFont(self): 45 45 if not DYNAMIC_WORKABLE: 46 self.fail("You can not use Dynamic Captchas, only Static one " \47 "unless install PIL with _imagingft C module into python, " \48 "that is used for the current Zope instance.")46 self.fail("You can not use Dynamic Captchas, only Static one " 47 "unless install PIL with _imagingft C module into " 48 "python, that is used for the current Zope instance.") 49 49 50 50 … … 87 87 88 88 img_ctype = img_html.getHeader('content-type') 89 self.assertTrue(img_ctype == 'image/jpeg', "Wrong content type for " \ 90 "generated image: %s, must be 'image/jpeg'" % img_ctype) 91 self.assertTrue(img_html.status == 200, "Wrong response status: " \ 92 "'%s', must be '200'" % img_html.status) 89 self.assertTrue(img_ctype == 'image/jpeg', 90 "Wrong content type for generated image: %s, " 91 "must be 'image/jpeg'" % img_ctype) 92 self.assertTrue(img_html.status == 200, "Wrong response status: " 93 "'%s', must be '200'" % img_html.status) 93 94 94 95 -
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testInstallation.py
r3144 r3600 28 28 pp = getToolByName(self.portal, 'portal_properties') 29 29 self.assert_(not PROPERTY_SHEET in pp.objectIds(), 30 'Property sheet found after uninstallation')30 'Property sheet found after uninstallation') 31 31 32 32 def testConfigletInstall(self): … … 83 83 self.qi.uninstallProducts([PRODUCT_NAME]) 84 84 self.assertNotEqual(self.qi.isProductInstalled(PRODUCT_NAME), True, 85 '%s is already installed' % PRODUCT_NAME)85 '%s is already installed' % PRODUCT_NAME) 86 86 self.assert_(not TOOL_ID in self.portal.objectIds()) 87 87 -
quintagroup.captcha.core/trunk/quintagroup/captcha/core/tests/testStatic.py
r3144 r3600 83 83 # set up a dummy state object 84 84 self.dummycs = ControllerState(id='prefs_captchas_setup_form', 85 context=self.portal, button='submit', status='success', 86 errors={}, ext_action=None,) 85 context=self.portal, button='submit', 86 status='success', errors={}, 87 ext_action=None,) 87 88 88 89 def testGoodData(self): -
quintagroup.captcha.core/trunk/quintagroup/captcha/core/utils.py
r3217 r3600 14 14 from quintagroup.captcha.core.data import basic_english 15 15 #import quintagroup.captcha.core configuration values 16 from quintagroup.captcha.core.config import (DEFAULT_IMAGE_SIZE, DEFAULT_BG, 17 DEFAULT_FONT_COLOR, DEFAULT_DISTORTION, CAPTCHAS_COUNT) 16 from quintagroup.captcha.core.config import ( 17 DEFAULT_IMAGE_SIZE, DEFAULT_BG, DEFAULT_FONT_COLOR, DEFAULT_DISTORTION, 18 CAPTCHAS_COUNT) 18 19 19 20 try: … … 119 120 xRows[j + 1][i + 1], yRows[j + 1][i + 1], 120 121 xRows[j][i + 1], yRows[j][i + 1]), 121 122 )) 122 123 123 124 img = image.transform(image.size, Image.MESH, mesh, Image.BILINEAR)
Note: See TracChangeset
for help on using the changeset viewer.