示例#1
0
    def test_systemctl_reload(self):
        '''
            Test to Reloads systemctl
        '''
        mock = MagicMock(side_effect=[1, 0])
        with patch.dict(systemd.__salt__, {'cmd.retcode': mock}):
            self.assertFalse(systemd.systemctl_reload())

            self.assertTrue(systemd.systemctl_reload())
示例#2
0
 def test_systemctl_reload(self):
     '''
         Test to Reloads systemctl
     '''
     mock = MagicMock(side_effect=[
         {'stdout': 'Who knows why?',
          'stderr': '',
          'retcode': 1,
          'pid': 12345},
         {'stdout': '',
          'stderr': '',
          'retcode': 0,
          'pid': 54321},
     ])
     with patch.dict(systemd.__salt__, {'cmd.run_all': mock}):
         self.assertRaisesRegexp(
             CommandExecutionError,
             'Problem performing systemctl daemon-reload: Who knows why?',
             systemd.systemctl_reload
         )
         self.assertTrue(systemd.systemctl_reload())
示例#3
0
 def test_systemctl_reload(self):
     '''
         Test to Reloads systemctl
     '''
     mock = MagicMock(side_effect=[
         {'stdout': 'Who knows why?',
          'stderr': '',
          'retcode': 1,
          'pid': 12345},
         {'stdout': '',
          'stderr': '',
          'retcode': 0,
          'pid': 54321},
     ])
     with patch.dict(systemd.__salt__, {'cmd.run_all': mock}):
         self.assertRaisesRegex(
             CommandExecutionError,
             'Problem performing systemctl daemon-reload: Who knows why?',
             systemd.systemctl_reload
         )
         self.assertTrue(systemd.systemctl_reload())