Beispiel #1
0
def test_auth_get_access_token(mocker):
    input_mock = mocker.patch('kiefer.auth._get_input')
    token_mock = mocker.patch('requests_oauthlib.OAuth2Session.fetch_token')
    token_mock.return_value = {'access_token': 'access',
                               'refresh_token': 'refresh'}
    auth = KieferAuth('tests/testconfig.json')
    access_token, refresh_token = auth.get_access_token()
    input_mock.assert_called_once_with('Please enter the full callback URL: ')
    assert token_mock.call_count == 1
    assert access_token == auth.access_token == 'access'
    assert refresh_token == auth.refresh_token == 'refresh'
Beispiel #2
0
def test_auth_get_access_token(mocker):
    input_mock = mocker.patch('kiefer.auth._get_input')
    token_mock = mocker.patch('requests_oauthlib.OAuth2Session.fetch_token')
    token_mock.return_value = {
        'access_token': 'access',
        'refresh_token': 'refresh'
    }
    auth = KieferAuth('tests/testconfig.json')
    access_token, refresh_token = auth.get_access_token()
    input_mock.assert_called_once_with('Please enter the full callback URL: ')
    assert token_mock.call_count == 1
    assert access_token == auth.access_token == 'access'
    assert refresh_token == auth.refresh_token == 'refresh'
def get_access_token():
    auth = KieferAuth('jawbone_secrets.json')
    return auth.get_access_token()
Beispiel #4
0
def get_access_token():
    auth = KieferAuth('jawbone_secrets.json')
    return auth.get_access_token()