I have a view as such:
def ProjectInfo(request): if request.method == 'POST': form = ProjectInfoForm(request.POST) if form.is_valid(): # if form is valid, iterate cleaned form data # and save data to session for k, v in form.cleaned_data.iteritems(): request.session[k] = v return HttpResponseRedirect('/next/') else: ... else: ...
And in my tests:
from django.test import TestCase, Client from django.core.urlresolvers import reverse from tool.models import Module, Model from django.contrib.sessions.models import Session def test_project_info_form_post_submission(self): """ Test if project info form can be submitted via post. """
So, when the last comment is in my test, I want to check if a specific value is specified in the session dict and that the correct key combination is: value. How can I do it? Can I use request.session ?
Any help is greatly appreciated.
Darwin tech
source share