Exemplo n.º 1
0
	def create_component(self, endpoint, component, token):
		json_str = CachetApiV1.create_component(endpoint, component.get_name(), component.get_status(), component.get_group_id(), token)
		if json_str == None:
			raise Exception(CONST_ERROR_MESSAGE_CACHET_API_V1)

		json_object = json.loads(json_str)
		component_json = json_object[CONST_DATA_JSON_ATTR]
		id = component_json[CONST_ID_JSON_ATTR]
		name = component_json[CONST_NAME_JSON_ATTR]
		return Component(id=id, name=name)
Exemplo n.º 2
0
 def test_create_component_error(self):
     response = CachetApiV1.create_component("http://wrong_url", "id", 1, 1,
                                             "token")
     self.assertIsNone(response)