def template_test(self, is_cman, corosync_output, corosync_retval=0): mock_runner = mock.MagicMock(spec_set=lib.CommandRunner) mock_runner.run.return_value = (corosync_output, corosync_retval) self.assertEqual(is_cman, lib.is_cman_cluster(mock_runner)) mock_runner.run.assert_called_once_with([ os.path.join(settings.corosync_binaries, "corosync"), "-v" ])
def is_cman_cluster(self): if self._is_cman_cluster is None: self._is_cman_cluster = is_cman_cluster(self.cmd_runner()) return self._is_cman_cluster