8
8
from landscape.broker.tests.test_remote import assertTransmitterActive
9
9
from landscape.tests.test_plugin import assertReceivesMessages
11
from twisted.internet.defer import Deferred
12
14
class DeploymentTest(LandscapeTest):
58
60
return assertReceivesMessages(self, self.monitor.dbus_service,
59
61
self.broker_service, self.remote)
63
def test_register_plugin_on_broker_started(self):
65
When the broker is restarted, it fires a "broker-started" signal which
66
makes the Monitor plugin register itself again.
69
def register_plugin(bus_name, object_path):
70
d.callback((bus_name, object_path))
72
self.monitor.remote_broker.register_plugin = register_plugin
73
self.broker_service.dbus_object.broker_started()
75
return self.remote.get_registered_plugins(
77
).addCallback(self.assertEquals,
78
("com.canonical.landscape.Monitor",
79
"/com/canonical/landscape/Monitor"))
81
def test_register_message_on_broker_started(self):
83
When the broker is restarted, it fires a "broker-started" signal which
84
makes the Monitor plugin register all registered messages again.
86
self.monitor.registry.register_message("foo", lambda x: None)
88
def register_client_accepted_message_type(type):
92
self.monitor.remote_broker.register_client_accepted_message_type = \
93
register_client_accepted_message_type
94
self.broker_service.dbus_object.broker_started()
96
return self.remote.get_registered_plugins(
98
).addCallback(self.assertEquals, "foo")
62
101
class MonitorTest(MonitorServiceTest):