Example #1
0
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
Example #2
0
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
Example #3
0
def get_test_api():
    test_api = PyfooAPI(account, api_key)
    test_api.make_call = test_make_call
    return test_api
Example #4
0
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
Example #5
0
File: tests.py Project: wufoo/pyfoo
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
Example #6
0
def get_test_api():
    test_api = PyfooAPI(account, api_key)
    test_api.make_call = test_make_call
    return test_api