Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
 def test_get_id(self):
     actual = get_id(MESSAGE1)
     self.assertEqual('1522072655d6e615', actual)