Beispiel #1
0
 def test_rollback_error(self):
     '''
     Test suseconnect.rollback 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.rollback()
Beispiel #2
0
 def test_rollback_error(self):
     """
     Test suseconnect.rollback 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.rollback()
Beispiel #3
0
 def test_rollback(self):
     '''
     Test suseconnect.rollback without parameters
     '''
     result = {
         'retcode': 0,
         'stdout': 'Starting to sync system product activations',
     }
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.rollback(),
                          'Starting to sync system product activations')
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--rollback'])
Beispiel #4
0
 def test_rollback(self):
     """
     Test suseconnect.rollback without parameters
     """
     result = {
         "retcode": 0,
         "stdout": "Starting to sync system product activations",
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.rollback(),
                          "Starting to sync system product activations")
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--rollback"])
Beispiel #5
0
 def test_rollback_params(self):
     """
     Test suseconnect.rollback with parameters
     """
     result = {
         "retcode": 0,
         "stdout": "Starting to sync system product activations",
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.rollback(url="https://scc.suse.com", root="/mnt"),
             "Starting to sync system product activations",
         )
         salt_mock["cmd.run_all"].assert_called_with([
             "SUSEConnect",
             "--rollback",
             "--url",
             "https://scc.suse.com",
             "--root",
             "/mnt",
         ])