mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
style: sort imports in api tests
This commit is contained in:
1 parent
55df230864
commit
b46b9a1d26
40 files changed
+142
-152
No files matched your search
@@ -16,14 +16,14 @@
|
||||
|
||||
|
||||
import sys
|
||||
import pytest
|
||||
import psutil
|
||||
|
||||
import psutil
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server.utils.path import get_default_project_directory
|
||||
from gns3server.version import __version__
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,16 +14,16 @@
|
||||
# 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 unittest.mock import patch, MagicMock
|
||||
import pytest
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.version import __version__
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.config import Config
|
||||
from gns3server.schemas.config import ServerSettings
|
||||
from gns3server.version import __version__
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
# 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 unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
from gns3server.compute.docker import Docker
|
||||
from gns3server.compute.docker.iol_docker_vm import IOLDockerVM
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import AsyncioMagicMock, asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,12 +14,12 @@
|
||||
# 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 pytest
|
||||
import sys
|
||||
import os
|
||||
import stat
|
||||
|
||||
import sys
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# 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 unittest.mock import MagicMock, call
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch, AsyncioMagicMock
|
||||
from unittest.mock import call, MagicMock
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import AsyncioMagicMock, asyncio_patch
|
||||
|
||||
# The builtin Ethernet switch talks to uBridge (brctl/bridge modules) instead of
|
||||
# the Dynamips hypervisor. These are the seams we stub so the routes can be
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import pytest
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
@@ -14,18 +14,18 @@
|
||||
# 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 pytest
|
||||
import pytest_asyncio
|
||||
import os
|
||||
import stat
|
||||
import uuid
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -16,12 +16,11 @@
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
# 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 pytest
|
||||
import json
|
||||
|
||||
import pytest
|
||||
|
||||
from gns3server.compute.notification_manager import NotificationManager
|
||||
|
||||
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
# 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 pytest
|
||||
import uuid
|
||||
import os
|
||||
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from gns3server.compute.project import Project
|
||||
from gns3server.compute.project_manager import ProjectManager
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
@@ -208,6 +208,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_dynamips_router_dispatch_to_slot_add_nio_binding(self):
|
||||
"""_add_nio_binding dispatches Dynamips router to slot_add_nio_binding."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
@@ -222,6 +223,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_dynamips_switch_dispatch_to_add_nio(self):
|
||||
"""_add_nio_binding dispatches Dynamips switch to add_nio."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
@@ -239,8 +241,8 @@ class TestBatchNIOEdgeCases:
|
||||
Dynamips.create_nio is async (returns a coroutine) unlike the sync
|
||||
base version. The batch handler must await it.
|
||||
"""
|
||||
import inspect
|
||||
import asyncio as _asyncio
|
||||
import inspect
|
||||
|
||||
class _FakeDynamips:
|
||||
async def create_nio(self, node, nio_settings):
|
||||
@@ -267,6 +269,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_qemu_dispatch_to_adapter_add_nio_binding(self):
|
||||
"""_add_nio_binding dispatches Qemu to adapter_add_nio_binding."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
@@ -281,6 +284,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_iou_dispatch_to_adapter_add_nio_binding(self):
|
||||
"""_add_nio_binding dispatches IOU to adapter_add_nio_binding(adapter, port, nio)."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
@@ -300,6 +304,7 @@ class TestBatchNIOEdgeCases:
|
||||
cross-wired links (the last entry per node wins).
|
||||
"""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import (
|
||||
_add_nio_binding,
|
||||
_get_existing_nio,
|
||||
@@ -326,6 +331,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_vpcs_dispatch_to_port_add_nio_binding(self):
|
||||
"""_add_nio_binding dispatches VPCS to port_add_nio_binding."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
@@ -340,6 +346,7 @@ class TestBatchNIOEdgeCases:
|
||||
async def test_builtin_dispatch_to_add_nio(self):
|
||||
"""_add_nio_binding dispatches Builtin nodes to add_nio(nio, port)."""
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
|
||||
from gns3server.api.routes.compute.projects import _add_nio_binding
|
||||
|
||||
node = MagicMock()
|
||||
|
||||
@@ -14,19 +14,19 @@
|
||||
# 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 os
|
||||
import shutil
|
||||
import stat
|
||||
import uuid
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
import os
|
||||
import stat
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# 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 pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# 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 pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# 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 pytest
|
||||
import pytest_asyncio
|
||||
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from tests.utils import asyncio_patch
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
import pytest_asyncio
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
|
||||
from gns3server.compute.project import Project
|
||||
from tests.utils import asyncio_patch
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
Reference in new issue
Block a user