def simulate_request(app, method='GET', path='/', query_string=None, headers=None, body=None, file_wrapper=None, params=None, params_csv=True):
 if (not path.startswith('/')):
  raise ValueError("path must start with '/'")
 if (query_string and query_string.startswith('?')):
  raise ValueError("query_string should not start with '?'")
 if ('?' in path):
  raise ValueError('path may not contain a query string. Please use the query_string parameter instead.')
 if (query_string is None):
  query_string = to_query_str(params, comma_delimited_lists=params_csv, prefix=False)
 env = helpers.create_environ(method=method, path=path, query_string=(query_string or ''), headers=headers, body=body, file_wrapper=file_wrapper)
 srmock = StartResponseMock()
 validator = wsgiref.validate.validator(app)
 iterable = validator(env, srmock)
 result = Result(iterable, srmock.status, srmock.headers)
 return result

def simulate_request ( app , method = 'GET' , path = '/' , query_string = None , headers = None , body = None , file_wrapper = None , params = None , params_csv = True ) : if ( not path . startswith ( '/' ) ) : raise ValueError ( "path must start with '/'" ) if ( query_string and query_string . startswith ( '?' ) ) : raise ValueError ( "query_string should not start with '?'" ) if ( '?' in path ) : raise ValueError ( 'path may not contain a query string. Please use the query_string parameter instead.' ) if ( query_string is None ) : query_string = to_query_str ( params , comma_delimited_lists = params_csv , prefix = False ) env = helpers . create_environ ( method = method , path = path , query_string = ( query_string or '' ) , headers = headers , body = body , file_wrapper = file_wrapper ) srmock = StartResponseMock ( ) validator = wsgiref . validate . validator ( app ) iterable = validator ( env , srmock ) result = Result ( iterable , srmock . status , srmock . headers ) return result
simulates a request to a wsgi application .