Thanks for the reply... I used the existing database instead of the test database to hook to the user's session like this:
from django.test.client import Client from django.contrib.sessions.models import Session client = Client() client.session = Session.objects.get(session_key = key_from_traceback) but did not work. Will it work, if I build a cookie back from the session and initialize the Client() with it? On 20 Ağustos, 12:19, Malcolm Tredinnick <[EMAIL PROTECTED]> wrote: > On Mon, 2007-08-20 at 09:13 +0000, omat wrote: > > There is an error that occurs occasionally and I suspect that it may > > be user specific (i.e. for users with certain credentials). > > > I need to run tests in the user's context, thus, I need to emulate the > > existing session of the user to test this. > > > I have the session id of the user that faced the error from the > > traceback that was mailed to me. > > > I have tried modifying the cookies and session attributes of the test > > client instance but I couldn't succeed. > > > How can I achieve this? > > The session id is just a key used to look up the session data from the > Sessions table. The data is stored in that table in pickled form (see > contrib.sessions for the details). So you don't just need the session > id. You also would need to pull out the appropriate session data and > store that in the test database that is created. Part of your test setup > would need to be putting data into the sessions table. > > Regards, > Malcolm > > -- > Two wrongs are only the beginning.http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---