예제 #1
0
def test_request(fx_github_access_token, fx_github_identity):
    result = request(
        fx_github_access_token,
        'https://api.github.com/user',
        'GET'
    )
    assert result['type'] == 'User'
    result2 = request(
        fx_github_identity,
        'https://api.github.com/user',
        'GET'
    )
    assert result == result2
예제 #2
0
def fx_github_identity(fx_github_access_token):
    global _fx_github_identity_cache
    if not _fx_github_identity_cache:
        _fx_github_identity_cache = request(fx_github_access_token,
                                            'https://api.github.com/user',
                                            'GET')
    return Identity(GitHubOrganization, _fx_github_identity_cache['login'],
                    fx_github_access_token)
예제 #3
0
def fx_github_identity(fx_github_access_token):
    global _fx_github_identity_cache
    if not _fx_github_identity_cache:
        _fx_github_identity_cache = request(
            fx_github_access_token,
            'https://api.github.com/user',
            'GET'
        )
    return Identity(
        GitHubOrganization,
        _fx_github_identity_cache['login'],
        fx_github_access_token
    )
예제 #4
0
def cleanup_ssh_keys(identity):
    keys = request(identity, GitHubKeyStore.LIST_URL, 'GET')
    for key in keys:
        url = GitHubKeyStore.DEREGISTER_URL.format(**key)
        request(identity, url, 'DELETE')
예제 #5
0
def test_request(fx_github_access_token, fx_github_identity):
    result = request(fx_github_access_token, 'https://api.github.com/user',
                     'GET')
    assert result['type'] == 'User'
    result2 = request(fx_github_identity, 'https://api.github.com/user', 'GET')
    assert result == result2
예제 #6
0
def cleanup_ssh_keys(identity):
    keys = request(identity, GitHubKeyStore.LIST_URL, 'GET')
    for key in keys:
        url = GitHubKeyStore.DEREGISTER_URL.format(**key)
        request(identity, url, 'DELETE')