def make_test_environ_builder(app, path='/', base_url=None, *args, **kwargs):
 http_host = app.config.get('SERVER_NAME')
 app_root = app.config.get('APPLICATION_ROOT')
 if (base_url is None):
  url = url_parse(path)
  base_url = ('http://%s/' % (url.netloc or http_host or 'localhost'))
  if app_root:
   base_url += app_root.lstrip('/')
  if url.netloc:
   path = url.path
   if url.query:
    path += ('?' + url.query)
 return EnvironBuilder(path, base_url, *args, **kwargs)

def make_test_environ_builder ( app , path = '/' , base_url = None , * args , ** kwargs ) : http_host = app . config . get ( 'SERVER_NAME' ) app_root = app . config . get ( 'APPLICATION_ROOT' ) if ( base_url is None ) : url = url_parse ( path ) base_url = ( 'http://%s/' % ( url . netloc or http_host or 'localhost' ) ) if app_root : base_url += app_root . lstrip ( '/' ) if url . netloc : path = url . path if url . query : path += ( '?' + url . query ) return EnvironBuilder ( path , base_url , * args , ** kwargs )
creates a new test builder with some application defaults thrown in .