-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fastapi tests running locally,
reduced external dependencies, removed duplicate test
- Loading branch information
1 parent
6a05ffc
commit 260b5b7
Showing
11 changed files
with
85 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import argparse | ||
import uvicorn | ||
|
||
|
||
def serve(app, port): | ||
"""Serve the web application.""" | ||
uvicorn.run(app, port=port) | ||
|
||
|
||
if __name__ == "__main__": | ||
argParser = argparse.ArgumentParser() | ||
argParser.add_argument("--app", help="app name") | ||
argParser.add_argument("--port", type=int, help="port number") | ||
args = argParser.parse_args() | ||
serve(args.app, args.port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from fastapi import FastAPI, Request | ||
|
||
app = FastAPI() | ||
|
||
|
||
@app.get("/big-response") | ||
def get_big_response(): | ||
return {"data": "a" * 10_000} | ||
|
||
|
||
@app.get("/little-response") | ||
def get_little_response(request: Request): | ||
return { | ||
"url": str(request.url), | ||
"data": "a" * 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
import argparse | ||
import uvicorn | ||
|
||
|
||
def serve(): | ||
def serve(app, port): | ||
"""Serve the web application.""" | ||
uvicorn.run("app:app", port=8000) | ||
uvicorn.run(app, port=port) | ||
|
||
|
||
if __name__ == "__main__": | ||
serve() | ||
argParser = argparse.ArgumentParser() | ||
argParser.add_argument("--app", help="app name") | ||
argParser.add_argument("--port", type=int, help="port number") | ||
args = argParser.parse_args() | ||
serve(args.app, args.port) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters