コード例 #1
0
    def setUp(self):
        patcher1 = patch('charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.load_config')  # NOQA
        self.addCleanup(patcher1.stop)
        self.mock_load_config = patcher1.start()

        patcher2 = patch('charlesbot_pagerduty_escalations.pagerdutyescalations.SlackUser')  # NOQA
        self.addCleanup(patcher2.stop)
        self.mock_slack_user = patcher2.start()

        patcher3 = patch('charlesbot_pagerduty_escalations.pagerdutyescalations.http_post_request')  # NOQA
        self.addCleanup(patcher3.stop)
        self.mock_http_post_request = patcher3.start()

        patcher4 = patch('charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.get_trigger_payload')  # NOQA
        self.addCleanup(patcher4.stop)
        self.mock_get_trigger_payload = patcher4.start()

        self.slack_message = SlackMessage(type="message",
                                          user="******",
                                          channel="C2147483705",
                                          text="This is a dummy message")

        from charlesbot_pagerduty_escalations.pagerdutyescalations import PagerdutyEscalations  # NOQA
        self.pd = PagerdutyEscalations()
        self.pd.slack = MagicMock()
        self.pd.slack.send_channel_message = MagicMock()
        self.pd.pd_service_mappings = {
            "service1": "pd_key_1"
        }
    def setUp(self):
        patcher1 = patch(
            'charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.load_config'
        )  # NOQA
        self.addCleanup(patcher1.stop)
        self.mock_load_config = patcher1.start()

        self.slack_message = SlackMessage(type="message",
                                          user="******",
                                          channel="C2147483705",
                                          text="This is a dummy message")

        from charlesbot_pagerduty_escalations.pagerdutyescalations import PagerdutyEscalations  # NOQA
        self.pd = PagerdutyEscalations()
        self.pd.slack.send_channel_message = MagicMock()
    def setUp(self):
        patcher1 = patch(
            'charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.load_config'
        )  # NOQA
        self.addCleanup(patcher1.stop)
        self.mock_load_config = patcher1.start()

        patcher2 = patch(
            'charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.print_service_list'
        )  # NOQA
        self.addCleanup(patcher2.stop)
        self.mock_print_service_list = patcher2.start()

        patcher3 = patch(
            'charlesbot_pagerduty_escalations.pagerdutyescalations.PagerdutyEscalations.trigger_escalation_incident'
        )  # NOQA
        self.addCleanup(patcher3.stop)
        self.mock_trigger_escalation_incident = patcher3.start()

        from charlesbot_pagerduty_escalations.pagerdutyescalations import PagerdutyEscalations  # NOQA
        self.pd = PagerdutyEscalations()