- 2010-09-20 22:15:42
- Unit Testing Session Data
- Board » General Category » General Discussion
I am trying to write a unit test that sets a session variable, calls a view and then checks the response.
My major problem is that It does not look like the session data is being passed to the view. Here is what I have so far.
session = SessionStore()
session['test'] = 'test text'
response = self.client.get(url)
session = self.client.session
X = session.get('test', None)
self.assertTrue(X) # this returns false.
- 2010-03-18 09:37:20
- Runserver and Apache + WSGI giving different results
- Board » Getting Started » Setup and Configuration
This project uses a customized version of the built-in Admin site feature.
When I run my project through run server everything seems to work fine.
When I user Apache + WSGI I get some weird results.
At first everything looks like it is working fine, but when I try to create or edit certain models I get the error:
ValidationError at /admin/pid/pid/add/
Request Method: POST
Request URL: http://localhost/persis/admin/pid/pid/add/
Exception Type: ValidationError
Exception Location: /usr/lib/pymodules/python2.6/django/forms/formsets.py in _management_form, line 54
Python Executable: /usr/bin/python
Python Version: 2.6.4
I also notice that when I use run server the Add form has an addition section which is missing when I use WSGI.
I think this section is being added with the function:
def add_view(self, request, form_url='', extra_context=None):
self.inline_instances0 = PurlTargetInline(self.model, self.admin_site)
self.fieldsets = (self.fieldset_pidtype, self.fieldset_pidinfo)
return super(PidAdmin, self).add_view(request, form_url, extra_context)
I still do not understand why I am gettng the error and why the section of the form is missing using WSGI.