Exemplo n.º 1
0
 def test_create_pull_request(self, mock_util, repo, gh_api):
     self.init_github()
     mock_util.mock_pulls(
         method=responses.POST,
         pulls=self._get_expected_pull_request(1, 1, "Test Body"),
     )
     pull_request = create_pull_request(repo, "test-branch")
     assert pull_request is not None
     assert pull_request.body == "Test Body"
Exemplo n.º 2
0
 def _get_parent_pull_request(self, branch_name):
     """Attempts to retrieve a pull request for the given branch.
     If one is not found, then it is created and the 'Build Change Notes' 
     label is applied to it."""
     requests = get_pull_requests_with_base_branch(self.repo,
                                                   self.repo.default_branch,
                                                   branch_name)
     if len(requests) == 0:
         self.logger.info(
             "Pull request not found. Creating pull request for branch: {} with base of 'master'."
             .format(branch_name))
         parent_pull_request = create_pull_request(self.repo, branch_name)
         add_labels_to_pull_request(self.repo, parent_pull_request,
                                    self.build_notes_label)
     else:
         parent_pull_request = requests[0]
     return parent_pull_request