diff --git a/force_bdss/tests/probe_classes/notification_listener.py b/force_bdss/tests/probe_classes/notification_listener.py index dc69480b5cb87fed0f9e43003322e634d527c7f5..5de05f50c9a4a7d16879db9cc4271f6efa345d44 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 db0ec2075bb2730c6ced366b877096fdc8c98ecb..79d4205f3a922cfe547bbdf67c2897f9395db308 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)