'Verifies error path.'

def verify_error(self, expected_response_status):

    self.request.COOKIES[settings.SESSION_COOKIE_NAME] = 'not-a-safe-cookie'
    with self.assert_parse_error():
        request_response = SafeSessionMiddleware().process_request(self.request)
        self.assertEquals(request_response.status_code, expected_response_status)
    self.assertTrue(self.request.need_to_delete_cookie)
    self.cookies_from_request_to_response()
    with patch('django.http.HttpResponse.set_cookie') as mock_delete_cookie:
        SafeSessionMiddleware().process_response(self.request, self.client.response)
        self.assertTrue(mock_delete_cookie.called)
