def is_sbd_installed(runner): """ Check if SBD service is installed in local system. Reurns True id SBD service is installed. False otherwise. runner -- CommandRunner """ return external.is_service_installed(runner, get_sbd_service_name())
def test_not_installed_systemd(self, mock_non_systemd, mock_systemd, mock_is_systemctl): mock_is_systemctl.return_value = True mock_systemd.return_value = ["service1", "service2"] mock_non_systemd.return_value = [] self.assertFalse(lib.is_service_installed(self.mock_runner, "service3")) self.assertEqual(mock_is_systemctl.call_count, 1) mock_systemd.assert_called_once_with(self.mock_runner) self.assertEqual(mock_non_systemd.call_count, 0)
def test_installed_not_systemd( self, mock_non_systemd, mock_systemd, mock_is_systemctl ): mock_is_systemctl.return_value = False mock_systemd.return_value = [] mock_non_systemd.return_value = ["service1", "service2"] self.assertTrue(lib.is_service_installed(self.mock_runner, "service2")) self.assertEqual(mock_is_systemctl.call_count, 1) mock_non_systemd.assert_called_once_with(self.mock_runner) self.assertEqual(mock_systemd.call_count, 0)