mirror of
https://github.com/GNS3/gns3-server
synced 2024-12-26 08:48:11 +00:00
Fix tests
This commit is contained in:
parent
7643185fa2
commit
93449c942f
@ -21,12 +21,19 @@ import shutil
|
|||||||
|
|
||||||
from fastapi import FastAPI, status
|
from fastapi import FastAPI, status
|
||||||
from httpx import AsyncClient
|
from httpx import AsyncClient
|
||||||
|
from gns3server.controller import Controller
|
||||||
|
|
||||||
pytestmark = pytest.mark.asyncio
|
pytestmark = pytest.mark.asyncio
|
||||||
|
|
||||||
|
|
||||||
class TestApplianceRoutes:
|
class TestApplianceRoutes:
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def _install_builtin_appliances(self, controller: Controller):
|
||||||
|
|
||||||
|
controller.appliance_manager.install_builtin_appliances()
|
||||||
|
controller.appliance_manager.load_appliances()
|
||||||
|
|
||||||
async def test_appliances_list(self, app: FastAPI, client: AsyncClient) -> None:
|
async def test_appliances_list(self, app: FastAPI, client: AsyncClient) -> None:
|
||||||
|
|
||||||
response = await client.get(app.url_path_for("get_appliances"))
|
response = await client.get(app.url_path_for("get_appliances"))
|
||||||
|
@ -263,6 +263,7 @@ class TestImageRoutes:
|
|||||||
controller: Controller
|
controller: Controller
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
||||||
|
controller.appliance_manager.install_builtin_appliances()
|
||||||
controller.appliance_manager.load_appliances() # make sure appliances are loaded
|
controller.appliance_manager.load_appliances() # make sure appliances are loaded
|
||||||
image_path = "tests/resources/empty30G.qcow2"
|
image_path = "tests/resources/empty30G.qcow2"
|
||||||
image_name = os.path.basename(image_path)
|
image_name = os.path.basename(image_path)
|
||||||
|
@ -380,6 +380,7 @@ def test_appliances(controller, config, tmpdir):
|
|||||||
json.dump(my_appliance, f)
|
json.dump(my_appliance, f)
|
||||||
|
|
||||||
config.settings.Server.appliances_path = str(tmpdir)
|
config.settings.Server.appliances_path = str(tmpdir)
|
||||||
|
controller.appliance_manager.install_builtin_appliances()
|
||||||
controller.appliance_manager.load_appliances()
|
controller.appliance_manager.load_appliances()
|
||||||
assert len(controller.appliance_manager.appliances) > 0
|
assert len(controller.appliance_manager.appliances) > 0
|
||||||
for appliance in controller.appliance_manager.appliances.values():
|
for appliance in controller.appliance_manager.appliances.values():
|
||||||
|
Loading…
Reference in New Issue
Block a user