Beispiel #1
0
def cron_clients_lang_update(lang):
    update = {
        'nodejs': google_api_nodejs_client.update,
        'php': php_update,
        'ruby': google_api_ruby_client.update,
    }.get(lang, None)
    if not update:
        abort(404)
    github_account = accounts.get_github_account()
    with TemporaryDirectory() as filepath:
        update(filepath, github_account)
    return ''
Beispiel #2
0
def cron_clients_lang_release(lang):
    release = {
        'nodejs': nodejs_release,
        'php': google_api_php_client_services.release,
        'ruby': ruby_release
    }.get(lang, None)
    if not release:
        abort(404)
    github_account = accounts.get_github_account()
    force = request.args.get('force', default=False, type=bool)
    with TemporaryDirectory() as filepath:
        release(filepath, github_account, force=force)
    return ''
Beispiel #3
0
def test_get_github_account(client_mock):
    query_mock = Mock()
    query_mock.return_value.fetch.return_value = [{
        'name':
        'Alice',
        'email':
        '*****@*****.**',
        'username':
        '******',
        'personal_access_token':
        'token'
    }]
    client_mock.return_value.query = query_mock
    expected = accounts.GitHubAccount('Alice', '*****@*****.**', 'test',
                                      'token')
    actual = accounts.get_github_account()
    query_mock.assert_called_once_with(kind='GitHubAccount')
    assert actual == expected
Beispiel #4
0
def cron_discoveries_pr():
    github_account = accounts.get_github_account()
    with TemporaryDirectory() as filepath:
        discovery_artifact_manager.create_pull_request(filepath, github_account)
    return ''
Beispiel #5
0
def cron_discoveries():
    github_account = accounts.get_github_account()
    with TemporaryDirectory() as filepath:
        discovery_artifact_manager.update(filepath, github_account)
    return ''