Fixes #1068 - handle zipfile encoding issues at project duplication

This commit is contained in:
ziajka authored and Julien Duponchelle committed 2017-06-09 15:32:25 +02:00
1 parent 5c0d955156
commit 64a852f38f
2 files changed
+11 -1

No files matched your search

+10
View File
@@ -23,6 +23,7 @@ import json
import pytest
import aiohttp
import zipfile
import zipstream
from unittest.mock import MagicMock
from tests.utils import AsyncioMagicMock, asyncio_patch
from unittest.mock import patch
@@ -439,6 +440,15 @@ def test_duplicate(project, async_run, controller):
assert list(new_project.nodes.values())[1].compute.id == "remote"
def test_duplicate_with_zipfile_encoding_issues(project, async_run, controller):
zf = zipstream.ZipFile()
zf.writestr('test\udcc3', "data")
with asyncio_patch('gns3server.controller.project.export_project', return_value=zf):
with pytest.raises(aiohttp.web.HTTPConflict):
async_run(project.duplicate(name="Hello"))
def test_snapshots(project):
"""
List the snapshots