示例#1
0
def test_get_access_token_yaml_error():
    """This function tests the get access token yaml function
    """
    with pytest.raises(Exception) as e_info:
        _ = utility.get_access_token_yaml('filename.yml')

        assert str(e_info.value) == 'Refresh token was not provided.'
示例#2
0
def test_get_access_token_yaml():
    """This function tests the get access token yaml function
    """
    access_token = utility.get_access_token_yaml('filename.yml')
    assert set(access_token.keys()) == set([
        'access_token', 'api_server', 'expires_in', 'refresh_token',
        'token_type'
    ])
    assert access_token['access_token'] == 'hunter2'
    assert access_token['api_server'] == 'www.api_url.com'
    assert access_token['expires_in'] == 1234
    assert access_token['refresh_token'] == 'hunter2'
    assert access_token['token_type'] == 'Bearer'
示例#3
0
def test_get_access_token_yaml():
    """This function tests the get access token yaml function
    """
    access_token = utility.get_access_token_yaml("filename.yml")
    assert set(access_token.keys()) == set([
        "access_token", "api_server", "expires_in", "refresh_token",
        "token_type"
    ])
    assert access_token["access_token"] == "hunter2"
    assert access_token["api_server"] == "www.api_url.com"
    assert access_token["expires_in"] == 1234
    assert access_token["refresh_token"] == "hunter2"
    assert access_token["token_type"] == "Bearer"
示例#4
0
def test_get_access_token_error():
    """This functions tests the error behaviour.
    """

    with pytest.raises(Exception) as e_info:
        access_token = utility.get_access_token_yaml('filename.yml')