def prepare_mock_wb_response(node=None, provider='github', files=None, folder=True, path='/', method=httpretty.GET, status_code=200):
 node = node
 files = (files or [])
 wb_url = waterbutler_api_url_for(node._id, provider=provider, path=path, meta=True)
 default_file = {u'contentType': None, u'extra': {u'downloads': 0, u'version': 1}, u'kind': u'file', u'modified': None, u'name': u'NewFile', u'path': u'/NewFile', u'provider': provider, u'size': None, u'materialized': '/'}
 if len(files):
  data = [dict(default_file, **each) for each in files]
 else:
  data = [default_file]
 jsonapi_data = []
 for datum in data:
  jsonapi_data.append({'attributes': datum})
 if (not folder):
  jsonapi_data = jsonapi_data[0]
 body = json.dumps({u'data': jsonapi_data})
 httpretty.register_uri(method, wb_url, body=body, status=status_code, content_type='application/json')

def prepare_mock_wb_response ( node = None , provider = 'github' , files = None , folder = True , path = '/' , method = httpretty . GET , status_code = 200 ) : node = node files = ( files or [ ] ) wb_url = waterbutler_api_url_for ( node . _id , provider = provider , path = path , meta = True ) default_file = { u'contentType' : None , u'extra' : { u'downloads' : 0 , u'version' : 1 } , u'kind' : u'file' , u'modified' : None , u'name' : u'NewFile' , u'path' : u'/NewFile' , u'provider' : provider , u'size' : None , u'materialized' : '/' } if len ( files ) : data = [ dict ( default_file , ** each ) for each in files ] else : data = [ default_file ] jsonapi_data = [ ] for datum in data : jsonapi_data . append ( { 'attributes' : datum } ) if ( not folder ) : jsonapi_data = jsonapi_data [ 0 ] body = json . dumps ( { u'data' : jsonapi_data } ) httpretty . register_uri ( method , wb_url , body = body , status = status_code , content_type = 'application/json' )
prepare a mock waterbutler response with httpretty .