#NEWLINE# def create_request( path , body , content_type , method = 'GET' , query_string = None , context = None ) : #NEWLINE# #INDENT# if query_string : #NEWLINE# #INDENT# url = ( '%s?%s' % ( path , query_string ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# url = path #NEWLINE# #UNINDENT# req = wsgi . Request . blank ( url ) #NEWLINE# req . method = method #NEWLINE# req . headers = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# req . headers [ 'Accept' ] = content_type #NEWLINE# if isinstance ( body , six . text_type ) : #NEWLINE# #INDENT# req . body = body . encode ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# req . body = body #NEWLINE# #UNINDENT# if context : #NEWLINE# #INDENT# req . environ [ 'neutron.context' ] = context #NEWLINE# #UNINDENT# return req