def test_make_call(url, post_params=None, method=None): post_params_string = '' if post_params: post_params_string = ''.join(post_params.keys()) path = 'scripts/%s%s.json' % (url.replace('/', '_'), post_params_string) try: test_script = open(path) json_object = json.load(test_script) test_script.close() except IOError as ex: api = PyfooAPI(account, api_key) json_object = api.make_call(url, post_params, method) print ex print '*** Using the regular API ***' return json_object
def get_test_api(): test_api = PyfooAPI(account, api_key) test_api.make_call = test_make_call return test_api
def get_test_api(): test_api = PyfooAPI(account, api_key, test_json_dir='test_scripts') test_api.make_call = test_make_call return test_api