Merge remote-tracking branch 'origin/master'

This commit is contained in:
grossmj 2015-05-25 19:07:23 -06:00
commit c43b26d787
6 changed files with 37 additions and 6 deletions

View File

@ -6,4 +6,3 @@ pep8==1.5.7
pytest-timeout
pytest-capturelog
pytest-cov
python-coveralls

View File

@ -19,6 +19,10 @@ import os
import sys
import struct
import platform
import faulthandler
# Display a traceback in case of segfault crash. Usefull when frozen
faulthandler.enable()
try:
import raven

View File

@ -74,7 +74,11 @@ class Qemu(BaseManager):
# add specific locations on Mac OS X regardless of what's in $PATH
paths.extend(["/usr/local/bin", "/opt/local/bin"])
if hasattr(sys, "frozen"):
paths.append(os.path.abspath(os.path.join(os.getcwd(), "../../../qemu/bin/")))
try:
paths.append(os.path.abspath(os.path.join(os.getcwd(), "../../../qemu/bin/")))
# If the user run the server by hand from outside
except FileNotFoundError:
paths.append(["/Applications/GNS3.app/Contents/Resources/qemu/bin"])
for path in paths:
try:
for f in os.listdir(path):

View File

@ -42,7 +42,7 @@ def test_vpcs_get(server, project, vm):
assert response.route == "/projects/{project_id}/vpcs/vms/{vm_id}"
assert response.json["name"] == "PC TEST 1"
assert response.json["project_id"] == project.id
assert response.json["startup_script_path"] == None
assert response.json["startup_script_path"] is None
def test_vpcs_create_startup_script(server, project):
@ -51,7 +51,7 @@ def test_vpcs_create_startup_script(server, project):
assert response.route == "/projects/{project_id}/vpcs/vms"
assert response.json["name"] == "PC TEST 1"
assert response.json["project_id"] == project.id
assert response.json["startup_script"] == "ip 192.168.1.2\necho TEST"
assert response.json["startup_script"] == os.linesep.join(["ip 192.168.1.2", "echo TEST"])
assert response.json["startup_script_path"] == "startup.vpc"

View File

@ -190,9 +190,9 @@ def test_update_startup_script_h(vm):
def test_get_startup_script(vm):
content = "echo GNS3 VPCS\nip 192.168.1.2\n"
content = os.linesep.join(["echo GNS3 VPCS", "ip 192.168.1.2"])
vm.startup_script = content
assert vm.startup_script == content
assert vm.startup_script == "echo GNS3 VPCS\nip 192.168.1.2"
def test_get_startup_script_using_default_script(vm):

View File

@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 GNS3 Technologies Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from gns3server.utils.interfaces import interfaces
def test_interfaces():
# This test should pass on all platforms without crash
assert isinstance(interfaces(), list)