def test_install(self): self.patch("subprocess.check_call", name="check_call") self.patch("charms_openstack.charm.OpenStackCharm.assess_status", name="assess_status") self.patch('builtins.super', name='super') c = manila.ManilaCharm() c.install() self.check_call.assert_called_once_with(["mkdir", "-p", "/etc/nova"]) self.assess_status.assert_called_once_with()
def _patch_config_and_charm(self, config): self.patch_object(charmhelpers.core.hookenv, 'config') def cf(key=None): if key is not None: return config[key] return config self.config.side_effect = cf c = manila.ManilaCharm() return c
def test_render_nrpe_checks(self): """Test NRPE renders correctly""" self.patch_object(manila.nrpe, 'NRPE') self.patch_object(manila.nrpe, 'add_init_service_checks') target = manila.ManilaCharm() target.render_nrpe_checks() self.add_init_service_checks.assert_has_calls([ mock.call().add_init_service_checks(mock.ANY, target.services, mock.ANY), ]) self.NRPE.assert_has_calls([ mock.call().write(), ])