Pavel Skvazh wrote:
> I've been searching throught the docs to figure it out but there's no
> clue. I've got a set up like  Using SQLAlchemy with Pylons suggests
> and my model relies on session, where current user_id is stored.
>
> Is there any way to access Pylons session in my model tests?
Relying on the HTTP session (if you're not referring to this one please
stop reading now :) in the model is very bad coupling IMHO. As a
workaround you could try to mock a session with something like:

class MyMockSession(dict):
    def save(*args, **kw):
         pass
    etc, ...

from pylons import session
session._push_object(MyMockSession(user_id="fooo"))

You might want to place that in the setUp method and place the
followiing in the tearDown this:

session._pop_object()

Alberto

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to