mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-10-22 10:52:21 +03:00
refactor: remove unused link filter schemas and fix test_add_v8_version_appliance
This commit is contained in:
parent
6004e06499
commit
4fc601e919
@ -213,8 +213,8 @@ __all__ = [
|
|||||||
"ATMSwitch",
|
"ATMSwitch",
|
||||||
"ATMSwitchCreate",
|
"ATMSwitchCreate",
|
||||||
"ATMSwitchUpdate",
|
"ATMSwitchUpdate",
|
||||||
"ApiKey",
|
|
||||||
"AnchorNIO",
|
"AnchorNIO",
|
||||||
|
"ApiKey",
|
||||||
"ApiKeyCreate",
|
"ApiKeyCreate",
|
||||||
"ApiKeyCreated",
|
"ApiKeyCreated",
|
||||||
"ApiKeyMessage",
|
"ApiKeyMessage",
|
||||||
|
|||||||
@ -139,29 +139,6 @@ class LinkFilters(BaseModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class LinkFilterParameter(BaseModel):
|
|
||||||
"""
|
|
||||||
Parameter of a packet filter.
|
|
||||||
"""
|
|
||||||
|
|
||||||
name: str
|
|
||||||
type: Literal["int", "text", "str"]
|
|
||||||
minimum: Optional[int] = None
|
|
||||||
maximum: Optional[int] = None
|
|
||||||
unit: Optional[str] = None
|
|
||||||
|
|
||||||
|
|
||||||
class LinkFilterDefinition(BaseModel):
|
|
||||||
"""
|
|
||||||
Packet filter available on a link.
|
|
||||||
"""
|
|
||||||
|
|
||||||
type: LinkFilterType
|
|
||||||
name: str
|
|
||||||
description: str
|
|
||||||
parameters: List[LinkFilterParameter]
|
|
||||||
|
|
||||||
|
|
||||||
class LinkBase(BaseModel):
|
class LinkBase(BaseModel):
|
||||||
"""
|
"""
|
||||||
Link data.
|
Link data.
|
||||||
|
|||||||
@ -105,7 +105,7 @@ class TestApplianceRoutes:
|
|||||||
async def test_add_v8_version_appliance(self, app: FastAPI, client: AsyncClient) -> None:
|
async def test_add_v8_version_appliance(self, app: FastAPI, client: AsyncClient) -> None:
|
||||||
|
|
||||||
appliance_id = "1cfdf900-7c30-4cb7-8f03-3f61d2581633" # Empty VM appliance
|
appliance_id = "1cfdf900-7c30-4cb7-8f03-3f61d2581633" # Empty VM appliance
|
||||||
new_version = {"name": "v8-99G", "category": "guest", "images": {"hda_disk_image": "empty99G.qcow2"}}
|
new_version = {"name": "v8-99G", "images": {"hda_disk_image": "empty99G.qcow2"}}
|
||||||
response = await client.post(
|
response = await client.post(
|
||||||
app.url_path_for("add_appliance_version", appliance_id=appliance_id), json=new_version
|
app.url_path_for("add_appliance_version", appliance_id=appliance_id), json=new_version
|
||||||
)
|
)
|
||||||
|
|||||||
@ -648,12 +648,12 @@ class TestLinkRoutes:
|
|||||||
assert "LinkFilters" not in schemas
|
assert "LinkFilters" not in schemas
|
||||||
filters_property = schemas["Link"]["properties"]["filters"]
|
filters_property = schemas["Link"]["properties"]["filters"]
|
||||||
assert filters_property["anyOf"][0] == {"additionalProperties": True, "type": "object"}
|
assert filters_property["anyOf"][0] == {"additionalProperties": True, "type": "object"}
|
||||||
assert schemas["LinkFilterDefinition"]["properties"]["parameters"]["items"] == {
|
assert schemas["LinkFilterInfo"]["properties"]["parameters"]["items"] == {
|
||||||
"$ref": "#/components/schemas/LinkFilterParameter"
|
"$ref": "#/components/schemas/LinkFilterParameter"
|
||||||
}
|
}
|
||||||
path = "/v3/projects/{project_id}/links/{link_id}/available_filters"
|
path = "/v3/projects/{project_id}/links/{link_id}/available_filters"
|
||||||
responses = app.openapi()["paths"][path]["get"]["responses"]["200"]["content"]["application/json"]["schema"]
|
responses = app.openapi()["paths"][path]["get"]["responses"]["200"]["content"]["application/json"]["schema"]
|
||||||
assert responses["items"] == {"$ref": "#/components/schemas/LinkFilterDefinition"}
|
assert responses["items"] == {"$ref": "#/components/schemas/LinkFilterInfo"}
|
||||||
|
|
||||||
async def test_get_udp_interface(self, app: FastAPI, client: AsyncClient, project: Project) -> None:
|
async def test_get_udp_interface(self, app: FastAPI, client: AsyncClient, project: Project) -> None:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user