Exemplo n.º 1
0
async def test_all_orgs(exec):
    all_orgs = gh.orgs()

    if live:
        orgs = await exec(all_orgs)

        assert isinstance(orgs, list)
        assert len(orgs) > 1
Exemplo n.º 2
0
def create_org_repo(org_handle, name):
    if "g" not in flask.session:
        return flask.abort(403, "No user")

    for org in github.orgs():
        if org["login"] == org_handle:
            return repo_create(name, org)

    return flask.abort(404, "No matching org")
Exemplo n.º 3
0
def index():
    if "g" in flask.session:
        user = github.current_user()
        flask.session["e"] = user["email"]
        orgs = github.orgs()
        org_repos = [github.repos(org=org["login"]) for org in orgs]
        return flask.render_template("index_logged_in.html",
                                     user=user,
                                     repos=github.repos(),
                                     orgs=orgs, org_repos=org_repos)
    return flask.render_template("index.html", auth_url=github.auth_url())
Exemplo n.º 4
0
import typing as t
from pathlib import Path
from functools import partial

import pytest

import snug
import github as gh
from snug.utils import replace

CRED_PATH = Path('~/.snug/github.json').expanduser()
auth = tuple(json.loads(CRED_PATH.read_bytes()))

resolve = partial(gh.resolve, auth=auth)

all_orgs = gh.orgs()
one_org = gh.org('github')
one_repo = gh.repo(owner='github', name='hub')
all_repos = gh.repos()

assigned_issues = gh.issues()

current_user = gh.current_user()
my_issues = current_user.issues()

repo_issues = one_repo.issues()
one_repo_issue = one_repo.issue(123)
one_repos_fixed_bugs = replace(repo_issues, labels='bug', state='closed')

live = pytest.config.getoption('--live')