Пример #1
0
 def test_list_extensions_error(self):
     '''
     Test suseconnect.list_extensions error
     '''
     result = {
         'retcode': 1,
         'stdout': 'To list extensions, you must first register '
         'the base product',
         'stderr': ''
     }
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.list_extensions()
Пример #2
0
 def test_list_extensions_params(self):
     """
     Test suseconnect.list_extensions with parameters
     """
     result = {
         "retcode": 0,
         "stdout": "Activate with: SUSEConnect -p sle-ha/15.2/x86_64",
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.list_extensions(url="https://scc.suse.com",
                                         root="/mnt"),
             ["sle-ha/15.2/x86_64"],
         )
         salt_mock["cmd.run_all"].assert_called_with([
             "SUSEConnect",
             "--list-extensions",
             "--url",
             "https://scc.suse.com",
             "--root",
             "/mnt",
         ])
Пример #3
0
 def test_list_extensions_error(self):
     """
     Test suseconnect.list_extensions error
     """
     result = {
         "retcode": 1,
         "stdout": "To list extensions, you must first register "
         "the base product",
         "stderr": "",
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.list_extensions()
Пример #4
0
 def test_list_extensions(self):
     '''
     Test suseconnect.list_extensions without parameters
     '''
     result = {
         'retcode': 0,
         'stdout': 'Activate with: SUSEConnect -p sle-ha/15.2/x86_64',
     }
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.list_extensions(),
                          ['sle-ha/15.2/x86_64'])
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--list-extensions'])
Пример #5
0
 def test_list_extensions(self):
     """
     Test suseconnect.list_extensions without parameters
     """
     result = {
         "retcode": 0,
         "stdout": "Activate with: SUSEConnect -p sle-ha/15.2/x86_64",
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.list_extensions(),
                          ["sle-ha/15.2/x86_64"])
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--list-extensions"])