Esempio n. 1
0
 def test_cleanup_error(self):
     '''
     Test suseconnect.cleanup error
     '''
     result = {'retcode': 1, 'stdout': 'some error', 'stderr': ''}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.cleanup()
Esempio n. 2
0
 def test_cleanup_error(self):
     """
     Test suseconnect.cleanup error
     """
     result = {"retcode": 1, "stdout": "some error", "stderr": ""}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.cleanup()
Esempio n. 3
0
 def test_cleanup(self):
     '''
     Test suseconnect.cleanup without parameters
     '''
     result = {'retcode': 0, 'stdout': 'Service has been removed'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.cleanup(), 'Service has been removed')
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--cleanup'])
Esempio n. 4
0
 def test_cleanup(self):
     """
     Test suseconnect.cleanup without parameters
     """
     result = {"retcode": 0, "stdout": "Service has been removed"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.cleanup(), "Service has been removed")
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--cleanup"])