mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-20 13:15:14 +02:00
Auto upload missing images
This commit is contained in:
15 files changed
+194
-65
No files matched your search
@@ -23,7 +23,7 @@ import asyncio
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
from gns3server.controller.project import Project
|
||||
from gns3server.controller.compute import Compute, ComputeError
|
||||
from gns3server.controller.compute import Compute, ComputeError, ComputeConflict
|
||||
from gns3server.version import __version__
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
|
||||
@@ -139,9 +139,19 @@ def test_compute_httpQueryNotConnectedNonGNS3Server2(compute, async_run):
|
||||
def test_compute_httpQueryError(compute, async_run):
|
||||
response = MagicMock()
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
response.status = 409
|
||||
response.status = 404
|
||||
|
||||
with pytest.raises(aiohttp.web.HTTPConflict):
|
||||
with pytest.raises(aiohttp.web.HTTPNotFound):
|
||||
async_run(compute.post("/projects", {"a": "b"}))
|
||||
|
||||
|
||||
def test_compute_httpQueryConflictError(compute, async_run):
|
||||
response = MagicMock()
|
||||
with asyncio_patch("aiohttp.ClientSession.request", return_value=response) as mock:
|
||||
response.status = 409
|
||||
response.read = AsyncioMagicMock(return_value=b'{"message": "Test"}')
|
||||
|
||||
with pytest.raises(ComputeConflict):
|
||||
async_run(compute.post("/projects", {"a": "b"}))
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user