示例#1
0
文件: tests.py 项目: Applaud/server
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
示例#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
示例#3
0
文件: tests.py 项目: Applaud/server
def get_test_api():
    test_api = PyfooAPI(account, api_key)
    test_api.make_call = test_make_call
    return test_api
示例#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
示例#5
0
文件: tests.py 项目: 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
示例#6
0
def get_test_api():
    test_api = PyfooAPI(account, api_key)
    test_api.make_call = test_make_call
    return test_api