Skip to content

Commit 51ac549

Browse files
committed
GH-5: Create a basic test-case
1 parent e57f7fb commit 51ac549

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/test_oauth2_middleware.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from fastapi import APIRouter
2+
from fastapi import FastAPI
3+
from fastapi.testclient import TestClient
4+
5+
from fastapi_oauth2.middleware import OAuth2Middleware
6+
from fastapi_oauth2.router import router as oauth2_router
7+
8+
app = FastAPI()
9+
router = APIRouter()
10+
11+
app.include_router(oauth2_router)
12+
app.add_middleware(OAuth2Middleware, config={})
13+
14+
client = TestClient(app)
15+
16+
17+
def test_read_main():
18+
response = client.get("/")
19+
assert response.status_code == 404

0 commit comments

Comments
 (0)