Skip to content

Commit

Permalink
added tests for fastapi
Browse files Browse the repository at this point in the history
  • Loading branch information
LeOndaz committed Oct 11, 2021
1 parent 07db972 commit 3dda2e3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sample_apps/fastapi/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# encoding: utf-8
from fastapi import FastAPI, Request

app = FastAPI()


@app.get('/')
def home(request: Request):
content = 'Home FastAPI'
if request.url.startswith('https://'):
content += ' SSL'

return content
4 changes: 4 additions & 0 deletions test_examples/pytest_example/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ def abspath(pth):
abspath('sample_apps/django/example'),
port=PORT
),
'FastAPI': liveandletdie.FastAPIServer(
abspath('sample_apps/fastapi/main.py'),
port=PORT
),
}


Expand Down
5 changes: 5 additions & 0 deletions test_examples/unittest_example/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class TestGAE(unittest.TestCase):
app = liveandletdie.GAE(environ['VIRTUAL_ENV'] + '/bin/dev_appserver',
abspath('sample_apps/gae'), port=PORT)

@test_decorator
class TestFastAPI(unittest.TestCase):
EXPECTED_TEXT = 'Home FastAPI'
app = liveandletdie.FastAPIServer(abspath('sample_apps/fastapi/main.py'), port=PORT)


if __name__ == '__main__':
unittest.main()

0 comments on commit 3dda2e3

Please sign in to comment.