|
| 1 | +#!/usr/bin/env python |
| 2 | +# |
| 3 | +# Copyright (C) 2017 GNS3 Technologies Inc. |
| 4 | +# |
| 5 | +# This program is free software: you can redistribute it and/or modify |
| 6 | +# it under the terms of the GNU General Public License as published by |
| 7 | +# the Free Software Foundation, either version 3 of the License, or |
| 8 | +# (at your option) any later version. |
| 9 | +# |
| 10 | +# This program is distributed in the hope that it will be useful, |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | +# GNU General Public License for more details. |
| 14 | +# |
| 15 | +# You should have received a copy of the GNU General Public License |
| 16 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | + |
| 18 | +from unittest.mock import MagicMock, patch |
| 19 | +from gns3.graphics_view import GraphicsView |
| 20 | +from gns3.node import Node |
| 21 | + |
| 22 | + |
| 23 | +def test_console_to_node_vncviewer_and_ipv6(): |
| 24 | + node = MagicMock( |
| 25 | + initialized=MagicMock(return_value=True), |
| 26 | + status=MagicMock(return_value=Node.started), |
| 27 | + consoleCommand=MagicMock(return_value="vncviewer"), |
| 28 | + consoleHost=MagicMock(return_value="::1") |
| 29 | + ) |
| 30 | + view = GraphicsView.__new__(GraphicsView) |
| 31 | + with patch('gns3.qt.QtWidgets.QMessageBox.warning') as warning_mock: |
| 32 | + view.consoleToNode(node) |
| 33 | + assert warning_mock.called |
| 34 | + assert warning_mock.call_args[0][1] == 'TightVNC' |
0 commit comments