def _invalid_wrong_node_type(self, system_data: SystemData): # Test invalid node type. node = ManagerObjNode() node.nodeId = 1 node.hostname = "hostname_1" node.nodeType = "sensor" node.instance = "instance_1" node.connected = 1 node.version = 1.0 node.rev = 0 node.username = "******" node.persistent = 1 system_data.update_node(node) manager = ManagerObjManager() manager.nodeId = 1 manager.managerId = 1 manager.description = "manager_1" is_exception = False try: system_data.update_manager(manager) except ValueError: is_exception = True if not is_exception: self.fail("Exception because of wrong node type expected.")
def _invalid_alert_level_missing(self, system_data: SystemData): # Test non-existing alert level. node = ManagerObjNode() node.nodeId = 1 node.hostname = "hostname_1" node.nodeType = "alert" node.instance = "instance_1" node.connected = 1 node.version = 1.0 node.rev = 0 node.username = "******" node.persistent = 1 system_data.update_node(node) alert = ManagerObjAlert() alert.nodeId = 1 alert.alertId = 1 alert.clientAlertId = 1 alert.alertLevels = [99] alert.description = "alert_1" is_exception = False try: system_data.update_alert(alert) except ValueError: is_exception = True if not is_exception: self.fail("Exception because of wrong node type expected.")
def _invalid_wrong_node_type(self, system_data: SystemData): # Test invalid node type. node = ManagerObjNode() node.nodeId = 1 node.hostname = "hostname_1" node.nodeType = "alert" node.instance = "instance_1" node.connected = 1 node.version = 1.0 node.rev = 0 node.username = "******" node.persistent = 1 system_data.update_node(node) sensor = ManagerObjSensor() sensor.nodeId = 1 sensor.sensorId = 1 sensor.clientSensorId = 1 sensor.alertDelay = 0 sensor.alertLevels = [] sensor.description = "sensor_1" sensor.lastStateUpdated = 0 sensor.state = 0 sensor.dataType = SensorDataType.NONE is_exception = False try: system_data.update_sensor(sensor) except ValueError: is_exception = True if not is_exception: self.fail("Exception because of wrong node type expected.") system_data = SystemData()