Esempio n. 1
0
 def test_deregister_error(self):
     '''
     Test suseconnect.deregister error
     '''
     result = {'retcode': 1, 'stdout': 'Unknown Product', 'stderr': ''}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.deregister()
Esempio n. 2
0
 def test_deregister_error(self):
     """
     Test suseconnect.deregister error
     """
     result = {"retcode": 1, "stdout": "Unknown Product", "stderr": ""}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.deregister()
Esempio n. 3
0
 def test_deregister_params(self):
     """
     Test suseconnect.deregister with parameters
     """
     result = {"retcode": 0, "stdout": "Successfully deregistered system"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.deregister(
                 product="sle-ha/15.2/x86_64",
                 url="https://scc.suse.com",
                 root="/mnt",
             ),
             "Successfully deregistered system",
         )
         salt_mock["cmd.run_all"].assert_called_with([
             "SUSEConnect",
             "--de-register",
             "--product",
             "sle-ha/15.2/x86_64",
             "--url",
             "https://scc.suse.com",
             "--root",
             "/mnt",
         ])
Esempio n. 4
0
 def test_deregister(self):
     '''
     Test suseconnect.deregister without parameters
     '''
     result = {'retcode': 0, 'stdout': 'Successfully deregistered system'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.deregister(),
                          'Successfully deregistered system')
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--de-register'])
Esempio n. 5
0
 def test_deregister(self):
     """
     Test suseconnect.deregister without parameters
     """
     result = {"retcode": 0, "stdout": "Successfully deregistered system"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.deregister(),
                          "Successfully deregistered system")
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--de-register"])
Esempio n. 6
0
 def test_deregister_params(self):
     '''
     Test suseconnect.deregister with parameters
     '''
     result = {'retcode': 0, 'stdout': 'Successfully deregistered system'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.deregister(product='sle-ha/15.2/x86_64',
                                    url='https://scc.suse.com',
                                    root='/mnt'),
             'Successfully deregistered system')
         salt_mock['cmd.run_all'].assert_called_with([
             'SUSEConnect', '--de-register', '--product',
             'sle-ha/15.2/x86_64', '--url', 'https://scc.suse.com',
             '--root', '/mnt'
         ])