Changeset 17280 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 14 Jan 2023, 04:57:11 (22 months ago)
- 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 1 1 <configure 2 2 xmlns="http://namespaces.zope.org/zope" 3 xmlns:browser="http://namespaces.zope.org/browser" 3 4 xmlns:kofa="http://namespaces.waeup.org/kofa" 4 5 i18n_domain="waeup.kofa" … … 50 51 principal="zope.Everybody" 51 52 /> 52 <grant 53 <grant 53 54 permission="waeup.Anonymous" 54 55 principal="zope.Anybody" … … 70 71 <grant role="zope.Manager" principal="zope.mgr" /> 71 72 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 72 82 </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 5 from dolmen.beaker.interfaces import ISessionConfig 6 from zope.component import queryUtility 1 7 from zope.component.hooks import setSite 2 8 from zope.publisher.browser import TestRequest 3 9 from zope.session.interfaces import ISession 4 10 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 11 5 12 6 13 class BeakerTests(FunctionalTestCase): … … 18 25 setSite(self.getRootFolder()) # needed to start transaction 19 26 request = TestRequest() 20 session = ISession(request) 27 session = ISession(request) # this is a Zope session 21 28 self.assertTrue(session.__module__.startswith('dolmen.beaker')) 29 self.assertTrue(session.get("_path", None) is not None) 22 30 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.