def _post_response(self, form_data): url = reverse('website:contact') request = self.factory.post(url, form_data) store = _create_session() request.session = store messages = FallbackStorage(request) request._messages = messages return contact_view(request)
def _get_response(self, user=None, session_data={}, referer=None): url = reverse('website:contact') request = self.factory.get(url) if user: request.user = user if referer: request.META['HTTP_REFERER'] = referer store = _create_session() request.session = store for k, v in session_data.items(): request.session[k] = v return contact_view(request)