Ejemplo n.º 1
0
 def test_register_error(self):
     '''
     Test suseconnect.register error
     '''
     result = {
         'retcode': 1,
         'stdout': 'Unknown Registration Code',
         'stderr': ''
     }
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.register('regcode')
Ejemplo n.º 2
0
 def test_register_error(self):
     """
     Test suseconnect.register error
     """
     result = {
         "retcode": 1,
         "stdout": "Unknown Registration Code",
         "stderr": ""
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         with self.assertRaises(CommandExecutionError):
             suseconnect.register("regcode")
Ejemplo n.º 3
0
 def test_register_params(self):
     """
     Test suseconnect.register with parameters
     """
     result = {"retcode": 0, "stdout": "Successfully registered system"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.register(
                 "regcode",
                 product="sle-ha/15.2/x86_64",
                 email="*****@*****.**",
                 url="https://scc.suse.com",
                 root="/mnt",
             ),
             "Successfully registered system",
         )
         salt_mock["cmd.run_all"].assert_called_with([
             "SUSEConnect",
             "--regcode",
             "regcode",
             "--product",
             "sle-ha/15.2/x86_64",
             "--email",
             "*****@*****.**",
             "--url",
             "https://scc.suse.com",
             "--root",
             "/mnt",
         ])
Ejemplo n.º 4
0
 def test_register(self):
     '''
     Test suseconnect.register without parameters
     '''
     result = {'retcode': 0, 'stdout': 'Successfully registered system'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.register('regcode'),
                          'Successfully registered system')
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--regcode', 'regcode'])
Ejemplo n.º 5
0
 def test_register(self):
     """
     Test suseconnect.register without parameters
     """
     result = {"retcode": 0, "stdout": "Successfully registered system"}
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.register("regcode"),
                          "Successfully registered system")
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--regcode", "regcode"])
Ejemplo n.º 6
0
 def test_register_params(self):
     '''
     Test suseconnect.register with parameters
     '''
     result = {'retcode': 0, 'stdout': 'Successfully registered system'}
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.register('regcode',
                                  product='sle-ha/15.2/x86_64',
                                  email='*****@*****.**',
                                  url='https://scc.suse.com',
                                  root='/mnt'),
             'Successfully registered system')
         salt_mock['cmd.run_all'].assert_called_with([
             'SUSEConnect', '--regcode', 'regcode', '--product',
             'sle-ha/15.2/x86_64', '--email', '*****@*****.**', '--url',
             'https://scc.suse.com', '--root', '/mnt'
         ])