예제 #1
0
    def test_notifySlack(self):
        responses.add(responses.POST,
                      "https://slack.com/api/chat.postMessage",
                      json=True,
                      status=200)

        status_code = plugins.notify_slack(self.message_template, ["devops"],
                                           CONSUL_SLACK)

        self.assertEqual(200, status_code)
예제 #2
0
    def test_notifySlackHipchat(self):
        responses.add(responses.POST, "https://slack.com/api/chat.postMessage", json=True, status=200)
        responses.add(responses.POST, "https://api.hipchat.com/v1/", json=True, status=200)

        status_code = plugins.notify_slack(self.message_template, ["devops"], CONSUL_SLACK)

        self.assertEqual(200, status_code)

        status_code = 0

        status_code = plugins.notify_hipchat(self.obj, self.message_template, ["devops"], CONSUL_HIPCHAT)

        self.assertEqual(200, status_code)
예제 #3
0
    def test_notifySlackFail(self):
        responses.add(responses.POST, "https://slack.com/api/chat.postMessage", json=True, status=400)

        status_code = plugins.notify_slack(self.message_template, ["devops"], CONSUL_SLACK)

        self.assertNotEqual(200, status_code)