From 30d6f1fa2a876e5fbb8423697533951b2ad361e0 Mon Sep 17 00:00:00 2001 From: grossmj Date: Mon, 2 Nov 2020 12:47:59 +1030 Subject: [PATCH] Make Swagger Ui the default for API documentation --- docs/{swagger.html => redoc.html} | 0 scripts/publish_api_documentation.py | 4 ++-- tests/endpoints/controller/test_templates.py | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) rename docs/{swagger.html => redoc.html} (100%) diff --git a/docs/swagger.html b/docs/redoc.html similarity index 100% rename from docs/swagger.html rename to docs/redoc.html diff --git a/scripts/publish_api_documentation.py b/scripts/publish_api_documentation.py index bcd46f2f..187c8a4d 100644 --- a/scripts/publish_api_documentation.py +++ b/scripts/publish_api_documentation.py @@ -32,11 +32,11 @@ if __name__ == "__main__": title=app.title + " - Swagger UI", 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()) redoc_html = get_redoc_html(openapi_url="openapi.json", 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()) diff --git a/tests/endpoints/controller/test_templates.py b/tests/endpoints/controller/test_templates.py index e71ba1b4..c5228dfb 100644 --- a/tests/endpoints/controller/test_templates.py +++ b/tests/endpoints/controller/test_templates.py @@ -592,9 +592,10 @@ async def test_dynamips_template_create_wrong_platform(controller_api): @pytest.mark.asyncio 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", "compute_id": "local", - "path": str(Path("/path/to/i86bi_linux-ipbase-ms-12.4.bin")), + "path": image_path, "template_type": "iou"} response = await controller_api.post("/templates", params) @@ -611,7 +612,7 @@ async def test_iou_template_create(controller_api): "ethernet_adapters": 2, "name": "IOU template", "nvram": 128, - "path": "/path/to/i86bi_linux-ipbase-ms-12.4.bin", + "path": image_path, "private_config": "", "ram": 256, "serial_adapters": 2, @@ -722,10 +723,11 @@ async def test_qemu_template_create(controller_api): @pytest.mark.asyncio async def test_vmware_template_create(controller_api): + vmx_path = str(Path("/path/to/vm.vmx")) params = {"name": "VMware template", "compute_id": "local", "template_type": "vmware", - "vmx_path": str(Path("/path/to/vm.vmx"))} + "vmx_path": vmx_path} response = await controller_api.post("/templates", params) assert response.status_code == 201 @@ -749,7 +751,7 @@ async def test_vmware_template_create(controller_api): "port_segment_size": 0, "symbol": ":/symbols/vmware_guest.svg", "use_any_adapter": False, - "vmx_path": "/path/to/vm.vmx", + "vmx_path": vmx_path, "custom_adapters": []} for item, value in expected_response.items():