mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
Fix ethernet interfaces tests if eth0 doesn't exists
Also on Windows and MacOS it return error if we try to use a non existing interfaces. Fix #230
This commit is contained in:
1 parent
bd4b6396a8
commit
7c7f8fe3ed
7 files changed
+38
-27
No files matched your search
@@ -15,6 +15,8 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import netifaces
|
||||
|
||||
from gns3server.utils.interfaces import interfaces, is_interface_up
|
||||
|
||||
@@ -25,6 +27,10 @@ def test_interfaces():
|
||||
|
||||
|
||||
def test_is_interface_up():
|
||||
assert is_interface_up("eth0") is True
|
||||
|
||||
|
||||
if sys.platform.startswith("win"):
|
||||
assert is_interface_up(netifaces.interfaces[0]) is True
|
||||
elif sys.platform.startswith("darwin"):
|
||||
assert is_interface_up("lo0") is True
|
||||
else:
|
||||
assert is_interface_up("lo") is True
|
||||
assert is_interface_up("fake0") is False
|
||||
Reference in new issue
Block a user