Ejemplo n.º 1
0
 def test_available(self):
     """
     Test for Returns ``True`` if the specified service is
     available, otherwise returns
     ``False``.
     """
     disabled_service = 'disabled'
     enabled_service = 'enabled'
     multilevel_service = 'multilevel'
     missing_service = 'missing'
     shutdown_service = 'shutdown'
     service_list = self.__services({disabled_service: [],
                                     enabled_service: ['default'],
                                     multilevel_service: ['default', 'shutdown'],
                                     shutdown_service: ['shutdown']})
     mock = MagicMock(return_value=service_list)
     with patch.dict(gentoo_service.__salt__, {'cmd.run': mock}):
         self.assertTrue(gentoo_service.available(enabled_service))
         self.assertTrue(gentoo_service.available(multilevel_service))
         self.assertTrue(gentoo_service.available(disabled_service))
         self.assertTrue(gentoo_service.available(shutdown_service))
         self.assertFalse(gentoo_service.available(missing_service))
Ejemplo n.º 2
0
 def test_available(self):
     '''
     Test for Returns ``True`` if the specified service is
     available, otherwise returns
     ``False``.
     '''
     disabled_service = 'disabled'
     enabled_service = 'enabled'
     multilevel_service = 'multilevel'
     missing_service = 'missing'
     shutdown_service = 'shutdown'
     service_list = self.__services({disabled_service: [],
                                     enabled_service: ['default'],
                                     multilevel_service: ['default', 'shutdown'],
                                     shutdown_service: ['shutdown']})
     mock = MagicMock(return_value=service_list)
     with patch.dict(gentoo_service.__salt__, {'cmd.run': mock}):
         self.assertTrue(gentoo_service.available(enabled_service))
         self.assertTrue(gentoo_service.available(multilevel_service))
         self.assertTrue(gentoo_service.available(disabled_service))
         self.assertTrue(gentoo_service.available(shutdown_service))
         self.assertFalse(gentoo_service.available(missing_service))
Ejemplo n.º 3
0
 def test_available(self):
     """
     Test for Returns ``True`` if the specified service is
     available, otherwise returns
     ``False``.
     """
     disabled_service = "disabled"
     enabled_service = "enabled"
     multilevel_service = "multilevel"
     missing_service = "missing"
     shutdown_service = "shutdown"
     service_list = self.__services({
         disabled_service: [],
         enabled_service: ["default"],
         multilevel_service: ["default", "shutdown"],
         shutdown_service: ["shutdown"],
     })
     mock = MagicMock(return_value=service_list)
     with patch.dict(gentoo_service.__salt__, {"cmd.run": mock}):
         self.assertTrue(gentoo_service.available(enabled_service))
         self.assertTrue(gentoo_service.available(multilevel_service))
         self.assertTrue(gentoo_service.available(disabled_service))
         self.assertTrue(gentoo_service.available(shutdown_service))
         self.assertFalse(gentoo_service.available(missing_service))