1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-13 20:08:55 +00:00

Fix tests

This commit is contained in:
grossmj 2022-12-22 09:24:17 +08:00
parent 7643185fa2
commit 93449c942f
3 changed files with 9 additions and 0 deletions

View File

@ -21,12 +21,19 @@ import shutil
from fastapi import FastAPI, status
from httpx import AsyncClient
from gns3server.controller import Controller
pytestmark = pytest.mark.asyncio
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:
response = await client.get(app.url_path_for("get_appliances"))

View File

@ -263,6 +263,7 @@ class TestImageRoutes:
controller: Controller
) -> None:
controller.appliance_manager.install_builtin_appliances()
controller.appliance_manager.load_appliances() # make sure appliances are loaded
image_path = "tests/resources/empty30G.qcow2"
image_name = os.path.basename(image_path)

View File

@ -380,6 +380,7 @@ def test_appliances(controller, config, tmpdir):
json.dump(my_appliance, f)
config.settings.Server.appliances_path = str(tmpdir)
controller.appliance_manager.install_builtin_appliances()
controller.appliance_manager.load_appliances()
assert len(controller.appliance_manager.appliances) > 0
for appliance in controller.appliance_manager.appliances.values():