setattr(request, 'session', 'session')
messages = FallbackStorage(request)
setattr(request, '_messages', messages)
How do I setup messaging and session middleware in a Django RequestFactory during unit testing