mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-24 17:28:08 +00:00
Make Swagger Ui the default for API documentation
This commit is contained in:
parent
359f9a7384
commit
30d6f1fa2a
@ -32,11 +32,11 @@ if __name__ == "__main__":
|
|||||||
title=app.title + " - Swagger UI",
|
title=app.title + " - Swagger UI",
|
||||||
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url)
|
oauth2_redirect_url=app.swagger_ui_oauth2_redirect_url)
|
||||||
|
|
||||||
with open("../docs/swagger.html", "w") as fd:
|
with open("../docs/index.html", "w") as fd:
|
||||||
fd.write(swagger_html.body.decode())
|
fd.write(swagger_html.body.decode())
|
||||||
|
|
||||||
redoc_html = get_redoc_html(openapi_url="openapi.json",
|
redoc_html = get_redoc_html(openapi_url="openapi.json",
|
||||||
title=app.title + " - ReDoc")
|
title=app.title + " - ReDoc")
|
||||||
|
|
||||||
with open("../docs/index.html", "w") as fd:
|
with open("../docs/redoc.html", "w") as fd:
|
||||||
fd.write(redoc_html.body.decode())
|
fd.write(redoc_html.body.decode())
|
||||||
|
@ -592,9 +592,10 @@ async def test_dynamips_template_create_wrong_platform(controller_api):
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_iou_template_create(controller_api):
|
async def test_iou_template_create(controller_api):
|
||||||
|
|
||||||
|
image_path = str(Path("/path/to/i86bi_linux-ipbase-ms-12.4.bin"))
|
||||||
params = {"name": "IOU template",
|
params = {"name": "IOU template",
|
||||||
"compute_id": "local",
|
"compute_id": "local",
|
||||||
"path": str(Path("/path/to/i86bi_linux-ipbase-ms-12.4.bin")),
|
"path": image_path,
|
||||||
"template_type": "iou"}
|
"template_type": "iou"}
|
||||||
|
|
||||||
response = await controller_api.post("/templates", params)
|
response = await controller_api.post("/templates", params)
|
||||||
@ -611,7 +612,7 @@ async def test_iou_template_create(controller_api):
|
|||||||
"ethernet_adapters": 2,
|
"ethernet_adapters": 2,
|
||||||
"name": "IOU template",
|
"name": "IOU template",
|
||||||
"nvram": 128,
|
"nvram": 128,
|
||||||
"path": "/path/to/i86bi_linux-ipbase-ms-12.4.bin",
|
"path": image_path,
|
||||||
"private_config": "",
|
"private_config": "",
|
||||||
"ram": 256,
|
"ram": 256,
|
||||||
"serial_adapters": 2,
|
"serial_adapters": 2,
|
||||||
@ -722,10 +723,11 @@ async def test_qemu_template_create(controller_api):
|
|||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_vmware_template_create(controller_api):
|
async def test_vmware_template_create(controller_api):
|
||||||
|
|
||||||
|
vmx_path = str(Path("/path/to/vm.vmx"))
|
||||||
params = {"name": "VMware template",
|
params = {"name": "VMware template",
|
||||||
"compute_id": "local",
|
"compute_id": "local",
|
||||||
"template_type": "vmware",
|
"template_type": "vmware",
|
||||||
"vmx_path": str(Path("/path/to/vm.vmx"))}
|
"vmx_path": vmx_path}
|
||||||
|
|
||||||
response = await controller_api.post("/templates", params)
|
response = await controller_api.post("/templates", params)
|
||||||
assert response.status_code == 201
|
assert response.status_code == 201
|
||||||
@ -749,7 +751,7 @@ async def test_vmware_template_create(controller_api):
|
|||||||
"port_segment_size": 0,
|
"port_segment_size": 0,
|
||||||
"symbol": ":/symbols/vmware_guest.svg",
|
"symbol": ":/symbols/vmware_guest.svg",
|
||||||
"use_any_adapter": False,
|
"use_any_adapter": False,
|
||||||
"vmx_path": "/path/to/vm.vmx",
|
"vmx_path": vmx_path,
|
||||||
"custom_adapters": []}
|
"custom_adapters": []}
|
||||||
|
|
||||||
for item, value in expected_response.items():
|
for item, value in expected_response.items():
|
||||||
|
Loading…
Reference in New Issue
Block a user