From 212efca52adcbcdde10cb601a2528718720cf38c Mon Sep 17 00:00:00 2001 From: Shahar Ilany <31574996+ShaharIlany@users.noreply.github.com> Date: Mon, 18 Jul 2022 23:33:55 +0300 Subject: [PATCH] feat(test_stoplight_elements_docs.py): add tests for the new feature --- tests/test_stoplight_elements_docs.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/test_stoplight_elements_docs.py diff --git a/tests/test_stoplight_elements_docs.py b/tests/test_stoplight_elements_docs.py new file mode 100644 index 000000000..7348d2836 --- /dev/null +++ b/tests/test_stoplight_elements_docs.py @@ -0,0 +1,21 @@ +from fastapi import FastAPI +from fastapi.testclient import TestClient + +app = FastAPI(title="White Shuli 2") + +@app.get("/pita/shuli") +async def get_shuli_in_a_pita(): + return {"shuli": "pita"} + +client = TestClient(app) + +def test_swagger_ui(): + response = client.get("/elements") + assert response.status_code == 200, response.text + print(response.text) + assert app.title in response.text + assert "Stoplight" in response.text + +def test_response(): + response = client.get("/pita/shuli") + assert response.json() == {"shuli": "pita"}