def create_incident(self, endpoint, incident, token): json_str = CachetApiV1.create_intent(endpoint, incident.get_name(), incident.get_message(), incident.get_status(), incident.get_visible(), incident.get_component_id(), incident.get_component_status(), token) if json_str == None: raise Exception(CONST_ERROR_MESSAGE_CACHET_API_V1) json_object = json.loads(json_str) incident_json = json_object[CONST_DATA_JSON_ATTR] id = incident_json[CONST_ID_JSON_ATTR] name = incident_json[CONST_NAME_JSON_ATTR] return Incident(id=id, name=name)
def test_create_intent_error(self): response = CachetApiV1.create_intent("http://wrong_url", "name", "message", "status", "visible", "componentId", "componentStatus", "token") self.assertIsNone(response)