Changeset 7307


Ignore:
Timestamp:
7 Dec 2011, 16:39:01 (13 years ago)
Author:
uli
Message:

Rename CaptchaChooser? to CaptchaManager?.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/browser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/captcha.py

    r7306 r7307  
    9494    """
    9595
    96 class ICaptchaChooser(Interface):
     96class ICaptchaManager(Interface):
    9797    """A chooser that collects available captchas.
    9898    """
     
    108108# Global captcha chooser
    109109#
    110 class CaptchaChooser(grok.GlobalUtility):
    111 
    112     grok.implements(ICaptchaChooser)
     110class CaptchaManager(grok.GlobalUtility):
     111
     112    grok.implements(ICaptchaManager)
    113113
    114114    def getAvailCaptchas(self):
     
    265265    * get the currently site-wide selected captcha type by doing::
    266266
    267         mycaptcha = getUtility(ICaptchaChooser).getCaptcha()
     267        mycaptcha = getUtility(ICaptchaManager).getCaptcha()
    268268
    269269    * if you want a specific captcha type (like ReCaptcha)::
  • main/waeup.sirp/trunk/src/waeup/sirp/browser/tests/test_captcha.py

    r7302 r7307  
    2323from waeup.sirp.testing import FunctionalLayer, FunctionalTestCase
    2424from waeup.sirp.browser.captcha import (
    25     ICaptchaResponse, ICaptchaRequest, ICaptcha, ICaptchaChooser)
     25    ICaptchaResponse, ICaptchaRequest, ICaptcha, ICaptchaManager)
    2626from waeup.sirp.browser.captcha import (
    2727    CaptchaResponse, CaptchaRequest, NullCaptcha, StaticCaptcha, ReCaptcha,
    28     CaptchaChooser)
     28    CaptchaManager)
    2929
    3030class CaptchaResponseTests(FunctionalTestCase):
     
    180180        return
    181181
    182 class CaptchaChooserTests(FunctionalTestCase):
     182class CaptchaManagerTests(FunctionalTestCase):
    183183    # These tests do not require a site setup
    184184    # See testsuite below for insite tests.
     
    188188    def test_ifaces(self):
    189189        # make sure we implement the promised interfaces
    190         obj = CaptchaChooser()
    191         verify.verifyClass(ICaptchaChooser, CaptchaChooser)
    192         verify.verifyObject(ICaptchaChooser, obj)
     190        obj = CaptchaManager()
     191        verify.verifyClass(ICaptchaManager, CaptchaManager)
     192        verify.verifyObject(ICaptchaManager, obj)
    193193        return
    194194
    195195    def test_utility(self):
    196196        # the global captcha chooser is registered as a global utility
    197         result = getUtility(ICaptchaChooser)
    198         self.assertTrue(isinstance(result, CaptchaChooser))
     197        result = getUtility(ICaptchaManager)
     198        self.assertTrue(isinstance(result, CaptchaManager))
    199199        return
    200200
    201201    def test_get_avail_captchas(self):
    202202        # we can get a dict of available captchas.
    203         chooser = getUtility(ICaptchaChooser)
     203        chooser = getUtility(ICaptchaManager)
    204204        result = dict(chooser.getAvailCaptchas())
    205205        no_captcha = result.get('No captcha', None)
     
    212212        # if there is no site set, we get the default captcha
    213213        setSite(None)
    214         chooser = getUtility(ICaptchaChooser)
     214        chooser = getUtility(ICaptchaManager)
    215215        result = chooser.getCaptcha()
    216216        default = getUtility(ICaptcha)
     
    221221    pass
    222222
    223 class CaptchaChooserTestsWithSite(FunctionalTestCase):
     223class CaptchaManagerTestsWithSite(FunctionalTestCase):
    224224
    225225    layer = FunctionalLayer
    226226
    227227    def setUp(self):
    228         super(CaptchaChooserTestsWithSite, self).setUp()
     228        super(CaptchaManagerTestsWithSite, self).setUp()
    229229        self.getRootFolder()['app'] = FakeSite()
    230230        self.site = self.getRootFolder()['app']
     
    232232
    233233    def tearDown(self):
    234         super(CaptchaChooserTestsWithSite, self).tearDown()
     234        super(CaptchaManagerTestsWithSite, self).tearDown()
    235235        clearSite(self.site)
    236236        return
     
    240240        # the default captcha
    241241        setSite(self.site)
    242         chooser = getUtility(ICaptchaChooser)
     242        chooser = getUtility(ICaptchaManager)
    243243        result = chooser.getCaptcha()
    244244        default = getUtility(ICaptcha)
     
    251251        setSite(self.site)
    252252        self.site['configuration'] = dict()
    253         chooser = getUtility(ICaptchaChooser)
     253        chooser = getUtility(ICaptchaManager)
    254254        result = chooser.getCaptcha()
    255255        default = getUtility(ICaptcha)
     
    262262        setSite(self.site)
    263263        self.site['configuration'] = dict(captcha='invalid name')
    264         chooser = getUtility(ICaptchaChooser)
     264        chooser = getUtility(ICaptchaManager)
    265265        result = chooser.getCaptcha()
    266266        default = getUtility(ICaptcha)
     
    273273        setSite(self.site)
    274274        self.site['configuration'] = dict(captcha='No captcha')
    275         chooser = getUtility(ICaptchaChooser)
     275        chooser = getUtility(ICaptchaManager)
    276276        result = chooser.getCaptcha()
    277277        no_captcha = getUtility(ICaptcha, name='No captcha')
Note: See TracChangeset for help on using the changeset viewer.