def test_pull_request_review_comment(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_review_comment.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request_review_comment', payload)
            expected_params = {
                'repo': 'Wikia/sparrow',
                'branch': 'test-branch',
                'commit': 'f96bc53e42b40dbbd0ceb19b68a3365e7a66f223',
                'pull_num': 31
            }
            jenkins_mock.build_job.assert_called_once_with('job5', expected_params)
    def test_push(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('push.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('push', payload)
            expected_params = {
                'repo': 'Wikia/app',
                'author': 'Kyle Daigle',
                'branch': 'wikia-logger-backtrace-for-errors',
                'commit': '4d2ab4e76d0d405d17d1a0f2b8a6071394e3ab40',
                'email': '*****@*****.**'
            }
            jenkins_mock.build_job.assert_called_once_with('job3', expected_params)
    def test_pull_request_merged_labels(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_merged.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request', payload)
            expected_params = {
                'repo': 'Wikia/ad-engine',
                'branch': 'ADEN-6924',
                'commit': 'e8f4b7c5a2c40fe14513ce27cc013cd7f779f9cc',
                'pull_num': 120,
                'labels': 'Major change,Foo'
            }
            jenkins_mock.build_job.assert_called_once_with('aden-job', expected_params)
    def test_extra_job_params(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_other_repo.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request', payload)
            expected_params = {
                'repo': 'Wikia/other',
                'branch': 'test-branch',
                'commit': 'f96bc53e42b40dbbd0ceb19b68a3365e7a66f223',
                'pull_num': 31,
                'silent': 'true',
                'labels': []
            }
            jenkins_mock.build_job.assert_called_once_with('job4', expected_params)
示例#5
0
    def test_push(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('push.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('push', payload)
            expected_params = {
                'repo': 'Wikia/app',
                'author': 'Kyle Daigle',
                'branch': 'wikia-logger-backtrace-for-errors',
                'commit': '4d2ab4e76d0d405d17d1a0f2b8a6071394e3ab40',
                'email': '*****@*****.**'
            }
            jenkins_mock.build_job.assert_called_once_with(
                'job3', expected_params)
示例#6
0
    def test_pull_request_review_comment(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_review_comment.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request_review_comment',
                                         payload)
            expected_params = {
                'repo': 'Wikia/sparrow',
                'branch': 'test-branch',
                'commit': 'f96bc53e42b40dbbd0ceb19b68a3365e7a66f223',
                'pull_num': 31,
            }
            jenkins_mock.build_job.assert_called_once_with(
                'job5', expected_params)
示例#7
0
    def test_pull_request_merged_labels(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_merged.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request', payload)
            expected_params = {
                'repo': 'Wikia/ad-engine',
                'branch': 'ADEN-6924',
                'commit': 'e8f4b7c5a2c40fe14513ce27cc013cd7f779f9cc',
                'pull_num': 120,
                'labels': 'Major change,Foo'
            }
            jenkins_mock.build_job.assert_called_once_with(
                'aden-job', expected_params)
示例#8
0
    def test_extra_job_params(self):
        jenkins_mock = mock.MagicMock()
        handler = GithubEventHandler(Config(self.config), jenkins_mock)
        with self.__fixture('pull_request_other_repo.json') as fp:
            payload = json.load(fp)

            handler.process_github_event('pull_request', payload)
            expected_params = {
                'repo': 'Wikia/other',
                'branch': 'test-branch',
                'commit': 'f96bc53e42b40dbbd0ceb19b68a3365e7a66f223',
                'pull_num': 31,
                'silent': 'true',
                'labels': []
            }
            jenkins_mock.build_job.assert_called_once_with(
                'job4', expected_params)