def test_format_comment_merged(self): """ This function tests 'format_comment' where the PR is merged """ # Call the function response = d.format_comment(self.mock_pr, 'merged', self.mock_client) # Assert Everything was called correctly self.assertEqual(response, "Merge request [mock_title| mock_url] was merged!")
def test_format_comment_open(self): """ This function tests 'format_comment' where the PR is open """ # Call the function response = d.format_comment(self.mock_pr, 'open', self.mock_client) # Assert Everything was called correctly self.assertEqual( response, "[~mock_key] mentioned this issue in merge request [mock_title| mock_url]." )
def test_format_comment_open_no_user_found(self): """ This function tests 'format_comment' where the PR is open and search_users returns nothing """ # Set up return values self.mock_client.search_users.return_value = [] # Call the function response = d.format_comment(self.mock_pr, 'open', self.mock_client) # Assert Everything was called correctly self.assertEqual( response, "mock_reporter mentioned this issue in merge request [mock_title| mock_url]." )