コード例 #1
0
ファイル: test_orgs.py プロジェクト: crosspop/github3.py
 def __init__(self, methodName='runTest'):
     super(TestTeam, self).__init__(methodName)
     if self.auth:
         org = self._g.organization(self.gh3py)
         self.team = org.team(190083)
     else:
         team = {'url': 'https://api.github.com/teams/190083',
                 'permission': 'pull', 'name': 'Collaborators',
                 'id': 190083}
         self.team = Team(team)
コード例 #2
0
ファイル: events.py プロジェクト: pydanny/github3.py
def _team(payload):
    from github3.orgs import Team
    from github3.repos import Repository
    from github3.users import User
    if payload.get('team'):
        payload['team'] = Team(payload['team'], None)
    if payload.get('repo'):
        payload['repo'] = Repository(payload['repo'], None)
    if payload.get('user'):
        payload['user'] = User(payload['user'], None)
    return payload
コード例 #3
0
ファイル: test_orgs.py プロジェクト: crosspop/github3.py
class TestTeam(BaseTest):
    def __init__(self, methodName='runTest'):
        super(TestTeam, self).__init__(methodName)
        if self.auth:
            org = self._g.organization(self.gh3py)
            self.team = org.team(190083)
        else:
            team = {'url': 'https://api.github.com/teams/190083',
                    'permission': 'pull', 'name': 'Collaborators',
                    'id': 190083}
            self.team = Team(team)

    def test_team(self):
        expect(self.team).isinstance(Team)
        expect(repr(self.team)) != ''
        self.team._update_(self.team.to_json())

    def test_edit(self):
        if self.auth:
            expect(self.team.edit(None)).is_False()
            expect(self.team.edit('Collabs')).is_True()
            expect(self.team.edit('Collaborators')).is_True()
        else:
            self.raisesGHE(self.team.edit, None)

    def test_has_repo(self):
        expect(self.team.has_repo('github3.py')).isinstance(bool)

    def test_is_member(self):
        expect(self.team.is_member(self.sigm)).isinstance(bool)

    def test_iter_members(self):
        if not self.auth:
            return
        members = [m for m in self.team.iter_members()]
        expect(members).list_of(User)

    def test_list_members(self):
        if not self.auth:
            return
        expect(self.team.list_members()).list_of(User)

    def test_iter_repos(self):
        if not self.auth:
            return
        repos = [r for r in self.team.iter_repos()]
        expect(repos).list_of(Repository)

    def test_list_repos(self):
        if not self.auth:
            return
        expect(self.team.list_repos()).list_of(Repository)

    def test_remove_member(self):
        if self.auth:
            expect(self.team.remove_member(self.sigm)).is_True()
        else:
            self.raisesGHE(self.team.remove_member, self.sigm)

    def test_remove_repo(self):
        if self.auth:
            expect(self.team.remove_repo(self.test_repo)).isinstance(bool)
        else:
            self.raisesGHE(self.team.remove_repo, self.test_repo)