From d57d8007a004b5f8362460d924963254646828e2 Mon Sep 17 00:00:00 2001 From: Stefano Borini <sborini@enthought.com> Date: Fri, 18 May 2018 10:21:28 +0100 Subject: [PATCH] Fixed remaining probe classes --- .../probe_classes/notification_listener.py | 27 +++++++++---------- force_bdss/tests/probe_classes/ui_hooks.py | 14 +++++----- 2 files changed, 21 insertions(+), 20 deletions(-) diff --git a/force_bdss/tests/probe_classes/notification_listener.py b/force_bdss/tests/probe_classes/notification_listener.py index dc69480..5de05f5 100644 --- a/force_bdss/tests/probe_classes/notification_listener.py +++ b/force_bdss/tests/probe_classes/notification_listener.py @@ -1,6 +1,5 @@ -from traits.api import Bool, Str, Type, Function, Any +from traits.api import Bool, Function, Any -from force_bdss.ids import factory_id from force_bdss.api import ( BaseNotificationListener, BaseNotificationListenerModel, BaseNotificationListenerFactory) @@ -43,25 +42,25 @@ class ProbeNotificationListenerModel(BaseNotificationListenerModel): class ProbeNotificationListenerFactory(BaseNotificationListenerFactory): - id = Str(factory_id("enthought", "test_nl")) - name = "test_notification_listener" - - model_class = Type(ProbeNotificationListenerModel) - - listener_class = Type(ProbeNotificationListener) - initialize_function = Function(default_value=pass_function) deliver_function = Function(default_value=pass_function) finalize_function = Function(default_value=pass_function) + def get_name(self): + return "test_notification_listener" + + def get_identifier(self): + return "test_nl" + + def get_listener_class(self): + return ProbeNotificationListener + + def get_model_class(self): + return ProbeNotificationListenerModel + def create_listener(self): return self.listener_class( self, initialize_function=self.initialize_function, deliver_function=self.deliver_function, finalize_function=self.finalize_function) - - def create_model(self, model_data=None): - if model_data is None: - model_data = {} - return self.model_class(self, **model_data) diff --git a/force_bdss/tests/probe_classes/ui_hooks.py b/force_bdss/tests/probe_classes/ui_hooks.py index db0ec20..79d4205 100644 --- a/force_bdss/tests/probe_classes/ui_hooks.py +++ b/force_bdss/tests/probe_classes/ui_hooks.py @@ -38,15 +38,17 @@ class ProbeUIHooksManager(BaseUIHooksManager): class ProbeUIHooksFactory(BaseUIHooksFactory): create_ui_hooks_manager_raises = Bool() - def __init__(self, plugin=None, *args, **kwargs): - if plugin is None: - plugin = mock.Mock(Plugin) + def get_identifier(self): + return "probe_ui_hooks" - super(ProbeUIHooksFactory, self).__init__( - plugin=plugin, *args, **kwargs) + def get_name(self): + return "Probe UI Hooks" + + def get_ui_hooks_manager_class(self): + return ProbeUIHooksManager def create_ui_hooks_manager(self): if self.create_ui_hooks_manager_raises: raise Exception("Boom") - return ProbeUIHooksManager(self) + return self.ui_hooks_manager_class(self) -- GitLab