Ignore:
Timestamp:
14 Jan 2023, 04:57:11 (22 months ago)
Author:
uli
Message:

Upgrade dolmen.beaker dependency. Requires new buildout run.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
1 deleted
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/ftesting.zcml

    r9855 r17280  
    11<configure
    22   xmlns="http://namespaces.zope.org/zope"
     3   xmlns:browser="http://namespaces.zope.org/browser"
    34   xmlns:kofa="http://namespaces.waeup.org/kofa"
    45   i18n_domain="waeup.kofa"
     
    5051      principal="zope.Everybody"
    5152      />
    52   <grant 
     53  <grant
    5354      permission="waeup.Anonymous"
    5455      principal="zope.Anybody"
     
    7071  <grant role="zope.Manager" principal="zope.mgr" />
    7172
     73   <!-- session -->
     74   <browser:beakerSession
     75        key="waeup.kofa.session.id"
     76        secret="KofaRocks"
     77        timeout="3600"
     78        type="cookie"
     79        validate_key="thisMightBeChanged"
     80        />
     81
    7282</configure>
  • main/waeup.kofa/trunk/src/waeup/kofa/tests/test_beaker.py

    r12110 r17280  
     1# We test beaker functionality, although we have no beaker-related code
     2# anymore. All configuration is done in ZCML snippets in
     3# site.zcml/ftesting.zcml now.
     4# The dolmen.beaker package is developed on: https://github.com/trollfot/dolmen.beaker
     5from dolmen.beaker.interfaces import ISessionConfig
     6from zope.component import queryUtility
    17from zope.component.hooks import setSite
    28from zope.publisher.browser import TestRequest
    39from zope.session.interfaces import ISession
    410from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
     11
    512
    613class BeakerTests(FunctionalTestCase):
     
    1825        setSite(self.getRootFolder()) # needed to start transaction
    1926        request = TestRequest()
    20         session = ISession(request)
     27        session = ISession(request)  # this is a Zope session
    2128        self.assertTrue(session.__module__.startswith('dolmen.beaker'))
     29        self.assertTrue(session.get("_path", None) is not None)
    2230        return
     31
     32    def test_beaker_session_values(self):
     33        # Ensure we get also a beaker session
     34        # (which is part of a Zope session)
     35        try:
     36            import dolmen.beaker
     37        except ImportError:
     38            # no beaker installed, no test
     39            return
     40        setSite(self.getRootFolder()) # needed to start transaction
     41        config = ISessionConfig
     42        request = TestRequest()
     43        session = ISession(request).session
     44        self.assertEqual(session.__module__, "beaker.session")
     45        self.assertTrue(session.get("_path", None) is not None)
     46        return
     47
     48    def test_beaker_config_accessible(self):
     49        # The session config is set in site.zcml / ftesting.zcml
     50        # See beakerSession directive
     51        # See https://github.com/trollfot/dolmen.beaker/blob/master/src/dolmen/beaker/zcml.py
     52        # for options
     53        config = queryUtility(ISessionConfig)
     54        self.assertEqual(config.get("key"), "waeup.kofa.session.id")
     55        self.assertEqual(config.get("timeout"), 3600)
Note: See TracChangeset for help on using the changeset viewer.