def test_get_changeset_info(self):
     body = get_body(MESSAGE1)
     expected = {'id': '01234', 'author': 'committer',
                 'comment': 'cloud config changes',
                 'url': 'https://code.domain.com/tfs/products/_versionControl/changeset/01234'}
     actual = get_changeset_info(body)
     self.assertDictEqual(expected, actual)
def process(service, labels, messages_details):
    for item in messages_details:
        subject = Msg.get_subject(item)

        if Msg.is_gocd_pattern(subject):
            gocd_details = Msg.get_gocd_details(subject)

            if slack.is_matching_send_rule(gocd_details):
                body = Msg.get_body(item)
                changeset = Msg.get_changeset_info(body)
                text = (slack
                        .message_builder(gocd_details,
                                         changeset,
                                         GOCD_DASHBOARD_URL))

                slack.send_to_slack(text, WEBHOOK_URL)

                Gm.add_label(service, Msg.get_id(item),
                             'SENT_TO_SLACK', labels)

        Gm.remove_label(service, Msg.get_id(item),
                        'UNREAD', labels)
 def test_get_changeset_comment_inline_with_revision_affected_file(self):
     body = get_body(CHANGESET_MSG_INLINE_WITH_REVISION_AND_AFFECTED_FILE)
     actual = get_changeset_comment(body)
     self.assertEqual('cloud config changes', actual)
 def test_get_changeset_author(self):
     body = get_body(MESSAGE1)
     actual = get_changeset_author(body)
     self.assertEqual('committer', actual)
 def test_get_changeset_comment_inline_with_revision(self):
     body = get_body(CHANGESET_MSG_INLINE_WITH_REVISION)
     actual = get_changeset_comment(body)
     self.assertEqual('cloud config changes', actual)
 def test_get_changeset_comment_from_individual_line(self):
     body = get_body(CHANGESET_MSG_ON_INDIVIDUAL_LINE)
     actual = get_changeset_comment(body)
     self.assertEqual('cloud config changes', actual)
 def test_get_changeset_id(self):
     body = get_body(MESSAGE1)
     actual = get_changeset_id(body)
     self.assertEqual('01234', actual)
 def test_get_changeset_url(self):
     body = get_body(MESSAGE1)
     actual = get_changeset_url(body)
     expected = 'https://code.domain.com/tfs/products/_versionControl/changeset/01234'
     self.assertEqual(expected, actual)
 def test_get_body(self):
     actual = get_body(MESSAGE1)
     self.assertIn('CHECK-INS', actual)