コード例 #1
0
ファイル: test_suseconnect.py プロジェクト: linpeifeng/yomi
 def test_status_error(self):
     '''
     Test suseconnect.status 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.status()
コード例 #2
0
ファイル: test_suseconnect.py プロジェクト: vmoutoussamy/yomi
 def test_status_error(self):
     """
     Test suseconnect.status 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.status()
コード例 #3
0
ファイル: test_suseconnect.py プロジェクト: vmoutoussamy/yomi
 def test_status_params(self):
     """
     Test suseconnect.status with parameters
     """
     result = {
         "retcode":
         0,
         "stdout":
         '[{"identifier":"SLES","version":"15.2",'
         '"arch":"x86_64","status":"No Registered"}]',
     }
     salt_mock = {
         "cmd.run_all": MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(
             suseconnect.status(root="/mnt"),
             [{
                 "identifier": "SLES",
                 "version": "15.2",
                 "arch": "x86_64",
                 "status": "No Registered",
             }],
         )
         salt_mock["cmd.run_all"].assert_called_with(
             ["SUSEConnect", "--status", "--root", "/mnt"])
コード例 #4
0
ファイル: test_suseconnect.py プロジェクト: linpeifeng/yomi
 def test_status(self):
     '''
     Test suseconnect.status without parameters
     '''
     result = {
         'retcode':
         0,
         'stdout':
         '[{"identifier":"SLES","version":"15.2",'
         '"arch":"x86_64","status":"No Registered"}]',
     }
     salt_mock = {
         'cmd.run_all': MagicMock(return_value=result),
     }
     with patch.dict(suseconnect.__salt__, salt_mock):
         self.assertEqual(suseconnect.status(), [{
             'identifier': 'SLES',
             'version': '15.2',
             'arch': 'x86_64',
             'status': 'No Registered',
         }])
         salt_mock['cmd.run_all'].assert_called_with(
             ['SUSEConnect', '--status'])