mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 14:01:15 +02:00
Merge branch '3.1' into feat/mcp-text-drawing-tool
This commit is contained in:
3 files changed
+37
-43
No files matched your search
@@ -486,7 +486,7 @@ class TestNodeRoutes:
|
||||
response = await client.get(app.url_path_for("get_node", project_id=project.id, node_id=node.id))
|
||||
assert response.json()["status"] == "started"
|
||||
|
||||
async def test_start_node_reports_starting_while_in_flight(
|
||||
async def test_start_node_keeps_real_status_while_in_flight(
|
||||
self, app: FastAPI, client: AsyncClient, project: Project, compute: Compute, node: Node
|
||||
) -> None:
|
||||
|
||||
@@ -498,10 +498,11 @@ class TestNodeRoutes:
|
||||
compute.post = post
|
||||
response = await client.post(app.url_path_for("start_node", project_id=project.id, node_id=node.id), json={})
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert seen == ["starting"]
|
||||
# no transitional status is reported while the call is in flight
|
||||
assert seen == ["stopped"]
|
||||
assert response.json()["status"] == "started"
|
||||
|
||||
async def test_stop_node_reports_stopping_while_in_flight(
|
||||
async def test_stop_node_keeps_real_status_while_in_flight(
|
||||
self, app: FastAPI, client: AsyncClient, project: Project, compute: Compute, node: Node
|
||||
) -> None:
|
||||
|
||||
@@ -514,7 +515,8 @@ class TestNodeRoutes:
|
||||
node._status = "started"
|
||||
response = await client.post(app.url_path_for("stop_node", project_id=project.id, node_id=node.id))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert seen == ["stopping"]
|
||||
# no transitional status is reported while the call is in flight
|
||||
assert seen == ["started"]
|
||||
assert response.json()["status"] == "stopped"
|
||||
|
||||
async def test_start_node_wait_timeout(
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
import pytest
|
||||
from fastapi import FastAPI, status
|
||||
from httpx import AsyncClient
|
||||
from starlette.routing import Mount
|
||||
|
||||
from gns3server.version import __version__
|
||||
|
||||
@@ -26,6 +27,14 @@ pytestmark = pytest.mark.asyncio
|
||||
class TestVersionRoutes:
|
||||
async def test_version_output(self, app: FastAPI, client: AsyncClient) -> None:
|
||||
|
||||
# controller_host is recorded on the mounted compute sub-application
|
||||
# when the controller queries the compute capabilities. Set it
|
||||
# directly so this test does not depend on another test having made
|
||||
# that call first (it failed when run on its own).
|
||||
for route in app.routes:
|
||||
if isinstance(route, Mount) and route.name == "compute":
|
||||
route.app.state.controller_host = "127.0.0.1"
|
||||
|
||||
response = await client.get(app.url_path_for("get_version"))
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
assert response.json() == {"controller_host": "127.0.0.1", "local": False, "version": __version__}
|
||||
|
||||
Reference in new issue
Block a user