Esempio n. 1
0
 def test_get_info(self, mock_exec_command, mock_dmidecode_parser_cls):
     mock_exec_command.return_value = 'blah'
     mparser = mock_dmidecode_parser_cls.return_value = mock.Mock()
     mparser.parse.return_value = {'key': 'value'}
     host = inspector.Host()
     rec = host.get_info()
     self.assertEqual(rec, {'key': 'value'})
Esempio n. 2
0
 def test_is_remote(self, get_ssh_client):
     get_ssh_client.return_value = mock.MagicMock()
     host = inspector.Host('test', 'user', 'pass')
     self.assertEqual(host.is_remote(), True)
Esempio n. 3
0
 def test_is_not_remote(self):
     host = inspector.Host()
     self.assertEqual(host.is_remote(), False)
Esempio n. 4
0
 def test_get_pci_devices(self, exec_command):
     host = inspector.Host()
     devs = host.get_pci_devices()
     exec_command.assert_called_once_with(['lspci', '-nnmm'])
Esempio n. 5
0
 def test_remote_exec_command(self, remote_command, get_ssh_client):
     mclient = get_ssh_client.return_value = mock.MagicMock()
     host = inspector.Host('mymachine', 'root', 'pass')
     host.exec_command('ls')
     inspector.remote_command.assert_called_once_with(mclient, 'ls')
Esempio n. 6
0
 def test_local_exec_command(self, local_command):
     host = inspector.Host()
     host.exec_command('ls')
     inspector.local_command.assert_called_once_with('ls')