コード例 #1
0
    def setUp(self):
        super(NRAlertConditionsTests, self).setUp()
        self.alert_conditions = AlertConditions(api_key='dummy_key')

        self.list_success_response = {
            "conditions": [{
                "id":
                "100",
                "type":
                "servers_metric",
                "name":
                "CPU usage alert",
                "condition_scope":
                "application",
                "enabled":
                True,
                "entities": ["1234567"],
                "metric":
                "cpu_percentage",
                "terms": [{
                    "duration": "5",
                    "operator": "above",
                    "priority": "above",
                    "threshold": "90",
                    "time_function": "all"
                }],
                "runbook_url":
                "http://example.com/"
            }]
        }

        self.single_success_response = {
            "condition": {
                "id":
                "100",
                "type":
                "servers_metric",
                "name":
                "CPU usage alert",
                "condition_scope":
                "application",
                "enabled":
                True,
                "entities": ["1234567"],
                "metric":
                "cpu_percentage",
                "terms": [{
                    "duration": "5",
                    "operator": "above",
                    "priority": "above",
                    "threshold": "90",
                    "time_function": "all"
                }],
                "runbook_url":
                "http://example.com/"
            }
        }