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)
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)
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)