コード例 #1
0
    def get_pull_request(self):
        fixture = load_fixture('pull_request.json')
        model = PullRequest(json.loads(fixture)['pull_request'])

        files = load_fixture('one_file_pull_request.json')
        model.files = lambda: create_pull_files(files)

        return GithubPullRequest(model)
コード例 #2
0
    def test_clone_url__private_fork__not_a_fork(self):
        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)['pull_request']

        pull = GithubPullRequest(PullRequest(data))
        eq_(False, pull.from_private_fork)
        eq_(data['head']['repo']['clone_url'], pull.clone_url)
        eq_('test', pull.head_branch)
コード例 #3
0
ファイル: test_repo.py プロジェクト: victorvianna/lint-review
    def test_maintainer_can_modify__forked_repo(self):
        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)['pull_request']

        # Make repo different
        data['head']['repo']['full_name'] = 'contributor/lint-test'
        pull = GithubPullRequest(PullRequest(data))
        eq_(True, pull.maintainer_can_modify, 'reflects flag')

        # Different repo reflects flag data
        data['maintainer_can_modify'] = False
        pull = GithubPullRequest(PullRequest(data))
        eq_(False, pull.maintainer_can_modify)

        data['maintainer_can_modify'] = True
        pull = GithubPullRequest(PullRequest(data))
        eq_(True, pull.maintainer_can_modify)
コード例 #4
0
    def test_clone_url__private_fork__not_a_fork(self):
        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)

        pull = GithubPullRequest(PullRequest(data, self.session))
        self.assertEqual(False, pull.from_private_fork)
        self.assertEqual(data['head']['repo']['clone_url'], pull.clone_url)
        self.assertEqual('test', pull.head_branch)
コード例 #5
0
    def test_clone_url__private_fork__forked(self):
        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)['pull_request']

        data['head']['repo']['full_name'] = 'contributor/lint-test'
        data['head']['repo']['fork'] = True

        pull = GithubPullRequest(PullRequest(data))
        eq_(False, pull.from_private_fork)
コード例 #6
0
ファイル: test_repo.py プロジェクト: victorvianna/lint-review
    def test_maintainer_can_modify__same_repo(self):
        pull = GithubPullRequest(self.model)
        eq_(True, pull.maintainer_can_modify)

        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)['pull_request']
        data['maintainer_can_modify'] = False

        model = PullRequest(data)
        pull = GithubPullRequest(model)
        eq_(True, pull.maintainer_can_modify)
コード例 #7
0
    def test_maintainer_can_modify__same_repo(self):
        pull = GithubPullRequest(self.model)
        self.assertEqual(True, pull.maintainer_can_modify)

        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)
        data['maintainer_can_modify'] = False

        model = PullRequest(data, self.session)
        pull = GithubPullRequest(model)
        self.assertEqual(True, pull.maintainer_can_modify)
コード例 #8
0
    def test_clone_url__private_fork(self):
        fixture = load_fixture('pull_request.json')
        data = json.loads(fixture)['pull_request']

        data['head']['repo']['full_name'] = 'contributor/lint-test'
        data['head']['repo']['clone_url'] = 'secret-repo'
        data['head']['repo']['fork'] = True
        data['head']['repo']['private'] = True
        pull = GithubPullRequest(PullRequest(data))
        eq_(True, pull.from_private_fork)
        eq_(data['base']['repo']['clone_url'], pull.clone_url)
        eq_('refs/pull/1/head', pull.head_branch)
コード例 #9
0
ファイル: events.py プロジェクト: pydanny/github3.py
def _pullreqev(payload):
    from github3.pulls import PullRequest
    if payload.get('pull_request'):
        payload['pull_request'] = PullRequest(payload['pull_request'], None)
    return payload
コード例 #10
0
ファイル: test_repo.py プロジェクト: victorvianna/lint-review
 def setUp(self):
     fixture = load_fixture('pull_request.json')
     self.model = PullRequest(json.loads(fixture)['pull_request'])