#NEWLINE# def MockHttpRequest( path = '/' , method = 'GET' , GET = None , POST = None , META = None , user = None ) : #NEWLINE# #INDENT# if ( GET is None ) : #NEWLINE# #INDENT# GET = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( POST is None ) : #NEWLINE# #INDENT# POST = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# method = 'POST' #NEWLINE# #UNINDENT# if ( method is None ) : #NEWLINE# #INDENT# META = { #NEWLINE# #INDENT# 'REMOTE_ADDR' : '127.0.0.1' , #NEWLINE# 'SERVER_PORT' : '8000' , #NEWLINE# 'HTTP_REFERER' : '' , #NEWLINE# 'SERVER_NAME' : 'testserver' , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# if ( user is None ) : #NEWLINE# #INDENT# user = AnonymousUser ( ) #NEWLINE# #UNINDENT# request = WsgiHttpRequest ( ) #NEWLINE# request . path = request . path_info = path #NEWLINE# request . method = method #NEWLINE# request . META = META #NEWLINE# request . GET = GET #NEWLINE# request . POST = POST #NEWLINE# request . user = user #NEWLINE# return request