📝 Add documentation about settings and env vars (#1118)

* Add doc and example for env var config

* Syntax highlight for .env file

* Add test for configuration docs

* 📝 Update settings docs, add more examples

* ✅ Add tests for settings

* 🚚 Rename "Application Configuration" to "Metadata and Docs URLs"

to disambiguate between that and settings

* 🔥 Remove replaced example file

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
alexmitelman
2020-04-02 07:55:20 +03:00
committed by GitHub
parent 6e1cd45a46
commit d4d5b21b2e
22 changed files with 448 additions and 11 deletions
@@ -0,0 +1,40 @@
from fastapi.testclient import TestClient
from metadata.tutorial001 import app
client = TestClient(app)
openapi_schema = {
"openapi": "3.0.2",
"info": {
"title": "My Super Project",
"version": "2.5.0",
"description": "This is a very fancy project, with auto docs for the API and everything",
},
"paths": {
"/items/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Read Items",
"operationId": "read_items_items__get",
}
}
},
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200
assert response.json() == openapi_schema
def test_items():
response = client.get("/items/")
assert response.status_code == 200
assert response.json() == [{"name": "Foo"}]