Пример #1
0
def test_request(fx_bitbucket_access_token: str,
                 fx_bitbucket_identity: Identity):
    result = request(fx_bitbucket_access_token,
                     'https://api.bitbucket.org/2.0/user', 'GET')
    assert result['type'] == 'user'
    result2 = request(fx_bitbucket_identity,
                      'https://api.bitbucket.org/2.0/user', 'GET')
    assert result == result2
Пример #2
0
def test_request(fx_github_access_token: str, fx_github_identity: 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
Пример #3
0
def fx_github_identity(fx_github_access_token: str) -> Identity:
    resp = request(
        fx_github_access_token,
        'https://api.github.com/user',
        'GET'
    )
    return Identity(GitHubOrganization, resp['login'], fx_github_access_token)
Пример #4
0
def cleanup_ssh_keys(identity: 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 cleanup_ssh_keys(identity: Identity):
    keys = request(identity, GitHubKeyStore.list_url, 'GET')
    for key in keys:
        url = GitHubKeyStore.deregister_url.format(**key)
        request(identity, url, 'DELETE')
Пример #6
0
def test_request(fx_github_access_token: str, fx_github_identity: 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
Пример #7
0
def fx_github_identity(fx_github_access_token: str) -> Identity:
    resp = request(fx_github_access_token, 'https://api.github.com/user',
                   'GET')
    return Identity(GitHubOrganization, resp['login'], fx_github_access_token)
Пример #8
0
def fx_bitbucket_identity(fx_bitbucket_access_token: str) -> Identity:
    resp = request(fx_bitbucket_access_token,
                   'https://api.bitbucket.org/2.0/user', 'GET')
    return Identity(BitbucketTeam, resp['username'], fx_bitbucket_access_token)