[Zope-dev] Zope 2.5.0 Sessions & Testing
Chris McDonough
chrism@zope.com
Tue, 08 Jan 2002 07:53:21 -0500
Your problem is that a REQUEST is not created without the
publisher. This is a particularly annoying and unsolved
problem when doing tests. Your options are to use "import
Zope; Zope.test('/some/method/name')" which has all sorts of
bad side effects, or to dummy up the environment as much as
possible via things like makerequest, etc. enough for the
method to work. I can't say exactly what's needed for that
in this case, I'd need to mess with it endlessly (luckily
that's your job in this case ;-)
Sorry,
- C
On Tue, 08 Jan 2002 10:16:16 +0000
Chris Withers <chrisw@nipltd.com> wrote:
> Hi,
>
> Trying to test a URL in a unittest.py test using code as
> follows:
>
> apply(Site.restrictedTraverse('/folder/cmfsite/skinmethod'),params)
>
> Now, skinmethod uses the new Zope 2.5.0 sessioning:
>
> session=context.REQUEST.SESSION
> session.set('key','value')
>
> but the BeforeTraversal hook doesn't seem to kick in when
> restrictedTraverse is
> used :-(
>
> We always get an AttributeError on SESSION.
>
> How should we fix this and go about testing this method
> properly?
>
> cheers,
>
> Chris
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> http://lists.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope )