1
from landscape.manager.eucalyptus import EucalyptusCloudManager
2
from landscape.tests.helpers import LandscapeTest, ManagerHelper
5
class EucalyptusCloudManagerTest(LandscapeTest):
7
helpers = [ManagerHelper]
10
super(EucalyptusCloudManagerTest, self).setUp()
11
message_type = EucalyptusCloudManager.message_type
12
self.broker_service.message_store.set_accepted_types([message_type])
13
self.plugin = EucalyptusCloudManager()
14
self.manager.add(self.plugin)
16
def test_plugin_registers_with_a_name(self):
18
L{EucalyptusCloudManager} provides a C{plugin_name}, which is used
19
when the plugin is registered with the manager plugin registry.
21
plugin_name = self.plugin.plugin_name
22
self.assertIs(self.plugin, self.manager.get_plugin(plugin_name))
24
def test_wb_plugin_deregisters_on_imagestore_import_fail(self):
26
When L{EucalyptusCloudManager.run} is called it tries to import code
27
from the C{imagestore} package. The plugin disables itself if an
28
exception is raised during this process.
30
plugin_name = self.plugin.plugin_name
31
self.assertIs(self.plugin, self.manager.get_plugin(plugin_name))
32
self.plugin._start_service_hub = lambda: 1/0
34
self.assertRaises(KeyError, self.manager.get_plugin, plugin_name)