1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

All tests pass on windows

This commit is contained in:
Julien Duponchelle 2016-09-28 10:27:30 +02:00
parent e01931269f
commit fb2dac6ef1
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8
6 changed files with 19 additions and 9 deletions

View File

@ -18,7 +18,6 @@
import os
import hashlib
from ..config import Config
from . import force_unix_path
@ -36,6 +35,7 @@ def scan_for_images(type):
files = set()
paths = []
for directory in images_directories(type):
directory = os.path.normpath(directory)
for root, _, filenames in os.walk(directory):
for file in filenames:
path = os.path.join(root, file)
@ -46,7 +46,7 @@ def scan_for_images(type):
or (file.endswith(".bin") and type == "iou") \
or (not file.endswith(".bin") and not file.endswith(".image") and type == "qemu"):
files.add(file)
paths.append(path)
paths.append(force_unix_path(path))
return paths

View File

@ -17,6 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import uuid
import json
import pytest
@ -109,7 +110,7 @@ def test_init_path(tmpdir):
p = Project(path=str(tmpdir), project_id=str(uuid4()), name="Test")
assert p.path == str(tmpdir)
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_changing_path_with_quote_not_allowed(tmpdir):
with pytest.raises(aiohttp.web.HTTPForbidden):
p = Project(project_id=str(uuid4()), name="Test")

View File

@ -19,12 +19,14 @@
This test suite check /version endpoint
It's also used for unittest the HTTP implementation.
"""
import sys
import pytest
from gns3server.config import Config
from gns3server.version import __version__
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_get(http_compute, windows_platform):
"""
Nat, is supported outside linux
@ -34,6 +36,7 @@ def test_get(http_compute, windows_platform):
assert response.json == {'node_types': ['cloud', 'ethernet_hub', 'ethernet_switch', 'vpcs', 'virtualbox', 'dynamips', 'frame_relay_switch', 'atm_switch', 'qemu', 'vmware', 'docker', 'iou'], 'version': __version__}
@pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
def test_get_on_gns3vm(http_compute, on_gns3vm):
response = http_compute.get('/capabilities', example=True)
assert response.status == 200

View File

@ -26,6 +26,7 @@ from tests.utils import asyncio_patch
from unittest.mock import patch, MagicMock, PropertyMock
from gns3server.compute.docker import Docker
pytestmark = pytest.mark.skipif(sys.platform.startswith("win"), reason="Not supported on Windows")
@pytest.fixture
def base_params():

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
import urllib.parse
from gns3server.config import Config
@ -34,7 +35,11 @@ def test_symbols(http_controller):
def test_get(http_controller):
response = http_controller.get('/symbols/' + urllib.parse.quote(':/symbols/firewall.svg') + '/raw')
assert response.status == 200
assert response.headers['CONTENT-LENGTH'] == '9381'
# Different carriage return
if sys.platform.startswith("win"):
assert response.headers['CONTENT-LENGTH'] == '9568'
else:
assert response.headers['CONTENT-LENGTH'] == '9381'
assert response.headers['CONTENT-TYPE'] == 'image/svg+xml'
assert '</svg>' in response.html

View File

@ -39,9 +39,9 @@ def test_images_directories(tmpdir):
# /tmp/null24564 is ignored because doesn't exists
res = images_directories("qemu")
assert res[0] == str(tmpdir / "images1" / "QEMU")
assert res[1] == str(tmpdir / "images2")
assert res[2] == str(tmpdir / "images1")
assert res[0] == force_unix_path(str(tmpdir / "images1" / "QEMU"))
assert res[1] == force_unix_path(str(tmpdir / "images2"))
assert res[2] == force_unix_path(str(tmpdir / "images1"))
assert len(res) == 3
@ -115,7 +115,7 @@ def test_scan_for_images(tmpdir):
with patch("gns3server.config.Config.get_section_config", return_value={
"images_path": str(tmpdir / "images1"),
"additional_images_path": "/tmp/null24564;{}".format(tmpdir / "images2"),
"additional_images_path": "/tmp/null24564;{}".format(str(tmpdir / "images2")),
"local": False}):
assert scan_for_images("dynamips") == [str(path1), str(path2)]