Add testing docs and tests (#151)

* ✏️ Fix typo in security intro

*  Add testing docs and tests

* 🐛 Debug Travis coverage

* 🐛 Debug Travis coverage, report XML

* 💚 Make Travis/Flit use same code install

*  Revert Travis/Codecov debugging changes
This commit is contained in:
Sebastián Ramírez
2019-04-12 20:15:05 +04:00
committed by GitHub
parent 613e211d20
commit 46e3811f8d
17 changed files with 241 additions and 5 deletions

View File

@@ -24,8 +24,8 @@ openapi_schema = {
},
},
},
"summary": "Read Item Get",
"operationId": "read_item_items__item_id__get",
"summary": "Read Items Get",
"operationId": "read_items_items__item_id__get",
"parameters": [
{
"required": True,

View File

View File

@@ -0,0 +1,30 @@
from app_testing.test_main import client, test_read_main
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "Fast API", "version": "0.1.0"},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Read Main Get",
"operationId": "read_main__get",
}
}
},
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200
assert response.json() == openapi_schema
def test_main():
test_read_main()

View File

@@ -0,0 +1,30 @@
from app_testing.tutorial001 import client, test_read_main
openapi_schema = {
"openapi": "3.0.2",
"info": {"title": "Fast API", "version": "0.1.0"},
"paths": {
"/": {
"get": {
"responses": {
"200": {
"description": "Successful Response",
"content": {"application/json": {"schema": {}}},
}
},
"summary": "Read Main Get",
"operationId": "read_main__get",
}
}
},
}
def test_openapi_schema():
response = client.get("/openapi.json")
assert response.status_code == 200
assert response.json() == openapi_schema
def test_main():
test_read_main()

View File

@@ -0,0 +1,9 @@
from app_testing.tutorial002 import test_read_main, test_websocket
def test_main():
test_read_main()
def test_ws():
test_websocket()

View File

@@ -0,0 +1,5 @@
from app_testing.tutorial003 import test_read_items
def test_main():
test_read_items()