Example #1
0
def test_setting_http_client_settings_in_integration(mocker):
    request = mocker.patch.object(requests.Session, 'request')
    api = Bearer(API_KEY).integration(BUID)
    api.get("/")

    request.assert_called_once_with('GET',
                                    URL,
                                    headers={
                                        'Authorization':
                                        API_KEY,
                                        'User-Agent':
                                        'Bearer-Python ({})'.format(VERSION)
                                    },
                                    json=None,
                                    params=None,
                                    timeout=5)
Example #2
0
def test_setting_http_client_settings_in_integration_and_host_in_bearer_class(
        mocker):
    request = mocker.patch.object(requests.Session, 'request')
    github = Bearer(API_KEY, host=CUSTOM_HOST).integration(
        BUID, http_client_settings={"timeout": 11})

    github.get("/")

    request.assert_called_once_with('GET',
                                    CUSTOM_URL,
                                    headers={
                                        'Authorization':
                                        API_KEY,
                                        'User-Agent':
                                        'Bearer-Python ({})'.format(VERSION)
                                    },
                                    json=None,
                                    params=None,
                                    timeout=11)