def test_engine_invalid(self): a_config = popup_handler.PopupHandlerConfigModel() a_config.popup_engine = "NOT-EXISTING" with self.assertRaises(configuration.ConfigurationException): a_handler = popup_handler.PopupHandler(p_config=a_config) self.assertIsNotNone(a_handler) a_handler.notify(p_text=TEXT)
def test_engine_zenity_init(self): a_config = popup_handler.PopupHandlerConfigModel() a_config.popup_engine = popup_handler.POPUP_ENGINE_ZENITY a_handler = popup_handler.PopupHandler(p_config=a_config) self.assertIsNotNone(a_handler) a_handler.notify(p_text=TEXT)
def test_engine_xmessage_init(self): a_config = popup_handler.PopupHandlerConfigModel() a_config.popup_engine = popup_handler.POPUP_ENGINE_XMESSAGE a_handler = popup_handler.PopupHandler(p_config=a_config) self.assertIsNotNone(a_handler) a_handler.notify(p_text=TEXT)
def test_engine_yad_init(self): a_config = popup_handler.PopupHandlerConfigModel() a_config.popup_engine = popup_handler.POPUP_ENGINE_YAD a_handler = popup_handler.PopupHandler(p_config=a_config) self.assertIsNotNone(a_handler) a_handler.notify(p_text="yad: " + TEXT)
def test_engine_bash_shell_init(self): a_config = popup_handler.PopupHandlerConfigModel() a_config.popup_engine = popup_handler.POPUP_ENGINE_SHELL_ECHO a_handler = popup_handler.PopupHandler(p_config=a_config) self.assertIsNotNone(a_handler) a_handler.notify(p_text="bash:" + TEXT)
def load_configuration(self, p_configuration): app_control_section = app_control.AppControlConfigModel() p_configuration.add_section(app_control_section) audio_handler_section = audio_handler.AudioHandlerConfigModel() p_configuration.add_section(audio_handler_section) popup_handler_section = popup_handler.PopupHandlerConfigModel() p_configuration.add_section(popup_handler_section) persistence_section = persistence.PersistenceConfigModel() p_configuration.add_section(persistence_section) rule_handler_section = rule_handler.RuleHandlerConfigModel() p_configuration.add_section(rule_handler_section) self._rule_set_section_handler = rule_handler.RuleSetSectionHandler() p_configuration.register_section_handler( p_section_handler=self._rule_set_section_handler) client_process_handler_section = client_process_handler.ClientProcessHandlerConfigModel( ) p_configuration.add_section(client_process_handler_section) client_device_handler_section = client_device_handler.ClientDeviceHandlerConfigModel( ) p_configuration.add_section(client_device_handler_section) self._client_device_section_handler = client_device_handler.ClientDeviceSectionHandler( ) p_configuration.register_section_handler( p_section_handler=self._client_device_section_handler) status_server_section = status_server.StatusServerConfigModel() p_configuration.add_section(status_server_section) master_connector_section = master_connector.MasterConnectorConfigModel( ) p_configuration.add_section(master_connector_section) self.app_config = AppConfigModel() p_configuration.add_section(self.app_config) return super(App, self).load_configuration(p_configuration=p_configuration)
def prepare_configuration(self, p_configuration): app_control_section = app_control.AppControlConfigModel() p_configuration.add_section(app_control_section) audio_handler_section = audio_handler.AudioHandlerConfigModel() audio_handler_section.spool_dir = os.path.join("/var/spool", constants.DIR_NAME) p_configuration.add_section(audio_handler_section) popup_handler_section = popup_handler.PopupHandlerConfigModel() p_configuration.add_section(popup_handler_section) persistence_section = persistence.PersistenceConfigModel() persistence_section.sqlite_dir = os.path.join("/var/spool", constants.DIR_NAME) p_configuration.add_section(persistence_section) rule_handler_section = rule_handler.RuleHandlerConfigModel() p_configuration.add_section(rule_handler_section) self._rule_set_section_handler = rule_handler.RuleSetSectionHandler() p_configuration.register_section_handler( p_section_handler=self._rule_set_section_handler) client_process_handler_section = client_process_handler.ClientProcessHandlerConfigModel( ) p_configuration.add_section(client_process_handler_section) client_device_handler_section = client_device_handler.ClientDeviceHandlerConfigModel( ) p_configuration.add_section(client_device_handler_section) self._client_device_section_handler = client_device_handler.ClientDeviceSectionHandler( ) p_configuration.register_section_handler( p_section_handler=self._client_device_section_handler) status_server_section = status_server.StatusServerConfigModel() p_configuration.add_section(status_server_section) master_connector_section = master_connector.MasterConnectorConfigModel( ) p_configuration.add_section(master_connector_section) prometheus_client_section = prometheus.PrometheusClientConfigModel() p_configuration.add_section(prometheus_client_section) self.app_config = AppConfigModel() p_configuration.add_section(self.app_config) user_handler_section = unix_user_handler.BaseUserHandlerConfigModel() p_configuration.add_section(user_handler_section) self._login_mapping_section_handler = login_mapping.LoginMappingSectionHandler( ) p_configuration.register_section_handler( p_section_handler=self._login_mapping_section_handler) return super( App, self).prepare_configuration(p_configuration=p_configuration)