mirror of https://github.com/tiangolo/fastapi.git
feat(test_stoplight_elements_docs.py): add tests for the new feature
This commit is contained in:
parent
80cb9b7514
commit
212efca52a
|
|
@ -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"}
|
||||
Loading…
Reference in New Issue