#75 Adding catch for PR comment
Merged 4 years ago by ralph. Opened 4 years ago by sidpremkumar.
sidpremkumar/sync-to-jira comment-fix  into  develop

Adding catch for PR comment
sidpremkumar • 4 years ago  
file modified
+4
@@ -65,6 +65,10 @@ 

                  log.info("Actual %r %r != expected %r", key, actual, expected)

                  return None

  

+     if 'pull_request' in msg['msg']['issue']:

+         log.info("%r is a pull request.  Ignoring.", msg['msg']['issue'].get('html_url'))

+         return None

+ 

      # Initialize Github object so we can get their full name (instead of their username)

      # And get comments if needed

      github_client = Github(config['sync2jira']['github_token'])

file modified
+22
@@ -393,6 +393,28 @@ 

          mock_github.assert_not_called()

          self.assertEqual(None, response)

  

+     @mock.patch(PATH + 'Github')

+     @mock.patch('sync2jira.intermediary.Issue.from_github')

+     def test_handle_github_message_pull_request(self,

+                                                 mock_issue_from_github,

+                                                 mock_github):

+         """

+         This function tests 'handle_github_message' the issue is a pull request comment

+         """

+         # Set up return values

+         self.mock_github_message['msg']['issue'] = {'pull_request': 'test'}

+ 

+         # Call the function

+         response = u.handle_github_message(

+             msg=self.mock_github_message,

+             config=self.mock_config

+         )

+ 

+         # Assert that all calls were made correctly

+         mock_issue_from_github.assert_not_called()

+         mock_github.assert_not_called()

+         self.assertEqual(None, response)

+ 

      @mock.patch('sync2jira.intermediary.Issue.from_github')

      def test_handle_github_message_bad_filter(self,

                                                mock_issue_from_github):

no initial comment

Pull-Request has been merged by ralph

4 years ago