def test_data_extraction_complete_and_sent_to_slack(self, mock_gm, mock_slack): integrations.process('service', LABELS, self.messages_details) self.assertEqual(1, mock_slack.call_count) self.assertEqual('http://hook.url', mock_slack.call_args[0][1]) expected_body = {'username': '******', 'icon_emoji': ':white_check_mark:', 'text': '<http://dash.url/tab/pipeline/history/product.branch.CI|product.branch.CI>\n' 'Changeset: ' '<https://code.domain.com/tfs/products/_versionControl/changeset/01234|01234> ' '- committer: cloud config changes' } actual_body = ast.literal_eval(str(mock_slack.call_args[0][0])) self.assertDictEqual(expected_body, actual_body)
def test_sent_slack_label_is_added_after_processing(self, mock_gm, mock_slack): integrations.process('service', LABELS, self.messages_details) expected = 'SENT_TO_SLACK' self.assertIn(expected, mock_gm.add_label.call_args[0])
def test_unread_label_is_removed_after_processing(self, mock_gm, mock_slack): integrations.process('service', LABELS, self.messages_details) expected = 'UNREAD' self.assertIn(expected, mock_gm.remove_label.call_args[0])