Esempio n. 1
0
    def test_connect_and_run(self, mock_install, mock_sysinfo, mock_bash):
        address = "192.0.2.2"
        config = mock.MagicMock()
        config.host_key = "foo"
        config.host_username = "******"
        mock_sysinfo.return_value = {}
        result = ohai_solo.get_systeminfo(address, config)
        self.assertTrue(result is mock_sysinfo.return_value)

        mock_install.assert_called_once_with(
            mock_bash.RemoteShell.return_value)

        mock_bash.RemoteShell.assert_called_with(
            address, username="******",
            private_key="foo",
            interactive=False)
        mock_sysinfo.assert_called_with(mock_bash.RemoteShell.return_value)
Esempio n. 2
0
    def test_connect_and_run(self, mock_install, mock_sysinfo, mock_bash):
        address = "192.0.2.2"
        config = {
            'host_key': 'foo',
            'host_username': '******',
        }
        mock_sysinfo.return_value = {}
        result = ohai_solo.get_systeminfo(address, config)
        self.assertTrue(result is mock_sysinfo.return_value)

        mock_install.assert_called_once_with(
            mock_bash.RemoteShell().__enter__.return_value)

        mock_bash.RemoteShell.assert_any_call(
            address, username="******",
            private_key="foo",
            interactive=False)
        mock_sysinfo.assert_called_with(
            mock_bash.RemoteShell().__enter__.return_value)
Esempio n. 3
0
    def test_connect_and_run(self, mock_install, mock_sysinfo, mock_bash):
        address = "192.0.2.2"
        config = {
            'host_key': 'foo',
            'host_username': '******',
        }
        mock_sysinfo.return_value = {}
        result = ohai_solo.get_systeminfo(address, config)
        self.assertTrue(result is mock_sysinfo.return_value)

        mock_install.assert_called_once_with(
            mock_bash.RemoteShell().__enter__.return_value)

        mock_bash.RemoteShell.assert_any_call(
            address, username="******",
            private_key="foo",
            interactive=False)
        mock_sysinfo.assert_called_with(
            mock_bash.RemoteShell().__enter__.return_value)