Exemplo n.º 1
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())
Exemplo n.º 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.assertRaisesRegex(
             CommandExecutionError,
             'Problem performing systemctl daemon-reload: Who knows why?',
             systemd.systemctl_reload
         )
         self.assertTrue(systemd.systemctl_reload())