1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-19 14:58:07 +00:00

Cleanup unused code in test_link

This commit is contained in:
Julien Duponchelle 2017-07-19 16:02:14 +02:00
parent f5e023222e
commit bce9c61e41
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -19,20 +19,16 @@
This test suite check /project endpoint This test suite check /project endpoint
""" """
import uuid
import os
import asyncio import asyncio
import aiohttp import aiohttp
import pytest import pytest
from unittest.mock import patch, MagicMock, PropertyMock from unittest.mock import patch, MagicMock
from tests.utils import asyncio_patch, AsyncioMagicMock from tests.utils import asyncio_patch, AsyncioMagicMock
from gns3server.handlers.api.controller.project_handler import ProjectHandler
from gns3server.controller import Controller from gns3server.controller import Controller
from gns3server.controller.ports.ethernet_port import EthernetPort from gns3server.controller.ports.ethernet_port import EthernetPort
from gns3server.controller.node import Node
from gns3server.controller.link import Link, FILTERS from gns3server.controller.link import Link, FILTERS
@ -107,7 +103,7 @@ def test_create_link_failure(http_controller, tmpdir, project, compute, async_ru
node1 = async_run(project.add_node(compute, "node1", None, node_type="qemu")) node1 = async_run(project.add_node(compute, "node1", None, node_type="qemu"))
node1._ports = [EthernetPort("E0", 0, 0, 3), EthernetPort("E0", 0, 0, 4)] node1._ports = [EthernetPort("E0", 0, 0, 3), EthernetPort("E0", 0, 0, 4)]
with asyncio_patch("gns3server.controller.udp_link.UDPLink.create") as mock: with asyncio_patch("gns3server.controller.udp_link.UDPLink.create"):
response = http_controller.post("/projects/{}/links".format(project.id), { response = http_controller.post("/projects/{}/links".format(project.id), {
"nodes": [ "nodes": [
{ {
@ -147,7 +143,7 @@ def test_update_link(http_controller, tmpdir, project, compute, async_run):
"frequency_drop": [50] "frequency_drop": [50]
} }
with asyncio_patch("gns3server.controller.udp_link.UDPLink.create") as mock: with asyncio_patch("gns3server.controller.udp_link.UDPLink.create"):
response = http_controller.post("/projects/{}/links".format(project.id), { response = http_controller.post("/projects/{}/links".format(project.id), {
"nodes": [ "nodes": [
{ {
@ -220,7 +216,7 @@ def test_list_link(http_controller, tmpdir, project, compute, async_run):
"port_number": 4 "port_number": 4
} }
] ]
with asyncio_patch("gns3server.controller.udp_link.UDPLink.create") as mock: with asyncio_patch("gns3server.controller.udp_link.UDPLink.create"):
response = http_controller.post("/projects/{}/links".format(project.id), { response = http_controller.post("/projects/{}/links".format(project.id), {
"nodes": nodes, "nodes": nodes,
"filters": filters "filters": filters