70c5d772aa
Also change repo URL in layer.yaml, make linter happy and add groovy to the metadata. Change-Id: I09513db77d110fd8acb3bfee7f6d78ae3f053ca3 Co-authored-by: Aurelien Lourot <aurelien.lourot@canonical.com>
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
import mock
|
|
|
|
import reactive.neutron_ironic_handlers as handlers
|
|
|
|
import charms_openstack.test_utils as test_utils
|
|
|
|
|
|
class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|
|
|
def test_hooks(self):
|
|
hook_set = {
|
|
'when': {
|
|
'configure_principle': (
|
|
'neutron-plugin-api-subordinate.connected', ),
|
|
'install_ironic': (
|
|
'neutron-plugin-api-subordinate.available', ),
|
|
'render_stuff': (
|
|
'identity-credentials.available', ),
|
|
'setup_endpoint': (
|
|
'identity-credentials.connected', ),
|
|
}
|
|
}
|
|
self.registered_hooks_test_helper(handlers, hook_set, [])
|
|
|
|
|
|
class TestHandlers(test_utils.PatchHelper):
|
|
|
|
def test_configure_principal(self):
|
|
mocked_reactive = mock.MagicMock()
|
|
self.patch_object(handlers, 'reactive',
|
|
name='reactive',
|
|
new=mocked_reactive)
|
|
principal_charm = mock.MagicMock()
|
|
mocked_reactive.endpoint_from_flag.return_value = principal_charm
|
|
principal_charm.neutron_config_data = {
|
|
'mechanism_drivers': 'driver1,driver2'
|
|
}
|
|
|
|
handlers.configure_principal()
|
|
principal_charm.configure_plugin.assert_called_once_with(
|
|
neutron_plugin='ironic',
|
|
mechanism_drivers='driver1,driver2,baremetal')
|